| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
RIO
Synopsis
- module RIO.Prelude
- module RIO.Prelude.Types
- newtype RIO env a = RIO {}
- liftRIO :: (MonadIO m, MonadReader env m) => RIO env a -> m a
- runRIO :: MonadIO m => env -> RIO env a -> m a
- module RIO.Prelude.Simple
- newtype UnliftIO (m :: Type -> Type) = UnliftIO {}
- class Monad m => MonadIO (m :: Type -> Type) where
- class MonadIO m => MonadUnliftIO (m :: Type -> Type) where
- withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b
- askRunInIO :: MonadUnliftIO m => m (m a -> IO a)
- askUnliftIO :: MonadUnliftIO m => m (UnliftIO m)
- liftIOOp :: MonadUnliftIO m => (IO a -> IO b) -> m a -> m b
- toIO :: MonadUnliftIO m => m a -> m (IO a)
- withUnliftIO :: MonadUnliftIO m => (UnliftIO m -> IO a) -> m a
- wrappedWithRunInIO :: MonadUnliftIO n => (n b -> m b) -> (forall a. m a -> n a) -> ((forall a. m a -> IO a) -> IO b) -> m b
- withLogFunc :: MonadUnliftIO m => LogOptions -> (LogFunc -> m a) -> m a
- newLogFunc :: (MonadIO n, MonadIO m) => LogOptions -> n (LogFunc, m ())
- data LogFunc
- class HasLogFunc env where
- logOptionsHandle :: MonadIO m => Handle -> Bool -> m LogOptions
- data LogOptions
- setLogMinLevel :: LogLevel -> LogOptions -> LogOptions
- setLogMinLevelIO :: IO LogLevel -> LogOptions -> LogOptions
- setLogVerboseFormat :: Bool -> LogOptions -> LogOptions
- setLogVerboseFormatIO :: IO Bool -> LogOptions -> LogOptions
- setLogTerminal :: Bool -> LogOptions -> LogOptions
- setLogUseTime :: Bool -> LogOptions -> LogOptions
- setLogUseColor :: Bool -> LogOptions -> LogOptions
- setLogUseLoc :: Bool -> LogOptions -> LogOptions
- setLogFormat :: (Utf8Builder -> Utf8Builder) -> LogOptions -> LogOptions
- setLogLevelColors :: (LogLevel -> Utf8Builder) -> LogOptions -> LogOptions
- setLogSecondaryColor :: Utf8Builder -> LogOptions -> LogOptions
- setLogAccentColors :: (Int -> Utf8Builder) -> LogOptions -> LogOptions
- logDebug :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()
- logInfo :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()
- logWarn :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()
- logError :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()
- logOther :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> Utf8Builder -> m ()
- logSticky :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m ()
- logStickyDone :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m ()
- logDebugS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()
- logInfoS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()
- logWarnS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()
- logErrorS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()
- logOtherS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> LogSource -> Utf8Builder -> m ()
- logGeneric :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> LogLevel -> Utf8Builder -> m ()
- mkLogFunc :: (CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()) -> LogFunc
- logOptionsMemory :: MonadIO m => m (IORef Builder, LogOptions)
- data LogLevel
- type LogSource = Text
- data CallStack
- displayCallStack :: CallStack -> Utf8Builder
- noLogging :: (HasLogFunc env, MonadReader env m) => m a -> m a
- logFuncUseColorL :: HasLogFunc env => SimpleGetter env Bool
- logFuncLogLevelColorsL :: HasLogFunc env => SimpleGetter env (LogLevel -> Utf8Builder)
- logFuncSecondaryColorL :: HasLogFunc env => SimpleGetter env Utf8Builder
- logFuncAccentColorsL :: HasLogFunc env => SimpleGetter env (Int -> Utf8Builder)
- glog :: (MonadIO m, HasCallStack, HasGLogFunc env, MonadReader env m) => GMsg env -> m ()
- data GLogFunc msg
- gLogFuncClassic :: (HasLogLevel msg, HasLogSource msg, Display msg) => LogFunc -> GLogFunc msg
- mkGLogFunc :: (CallStack -> msg -> IO ()) -> GLogFunc msg
- contramapMaybeGLogFunc :: (a -> Maybe b) -> GLogFunc b -> GLogFunc a
- contramapGLogFunc :: (a -> b) -> GLogFunc b -> GLogFunc a
- class HasGLogFunc env where
- class HasLogLevel msg where
- getLogLevel :: msg -> LogLevel
- class HasLogSource msg where
- getLogSource :: msg -> LogSource
- type family GMsg env
- class Display a where
- display :: a -> Utf8Builder
- textDisplay :: a -> Text
- newtype Utf8Builder = Utf8Builder {}
- displayShow :: Show a => a -> Utf8Builder
- utf8BuilderToText :: Utf8Builder -> Text
- utf8BuilderToLazyText :: Utf8Builder -> Text
- displayBytesUtf8 :: ByteString -> Utf8Builder
- writeFileUtf8Builder :: MonadIO m => FilePath -> Utf8Builder -> m ()
- type Lens s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t
- lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
- view :: MonadReader s m => Getting a s a -> m a
- preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a)
- type ASetter s t a b = (a -> Identity b) -> s -> Identity t
- type ASetter' s a = ASetter s s a a
- type Getting r s a = (a -> Const r a) -> s -> Const r s
- type Lens' s a = Lens s s a a
- type SimpleGetter s a = forall r. Getting r s a
- over :: ASetter s t a b -> (a -> b) -> s -> t
- set :: ASetter s t a b -> b -> s -> t
- sets :: ((a -> b) -> s -> t) -> ASetter s t a b
- to :: (s -> a) -> SimpleGetter s a
- (^.) :: s -> Getting a s a -> a
- (^?) :: s -> Getting (First a) s a -> Maybe a
- (^..) :: s -> Getting (Endo [a]) s a -> [a]
- (%~) :: ASetter s t a b -> (a -> b) -> s -> t
- (.~) :: ASetter s t a b -> b -> s -> t
- data ThreadId
- myThreadId :: MonadIO m => m ThreadId
- isCurrentThreadBound :: MonadIO m => m Bool
- threadWaitRead :: MonadIO m => Fd -> m ()
- threadWaitWrite :: MonadIO m => Fd -> m ()
- threadDelay :: MonadIO m => Int -> m ()
- yieldThread :: MonadIO m => m ()
- async :: MonadUnliftIO m => m a -> m (Async a)
- data Async a
- link :: MonadIO m => Async a -> m ()
- link2 :: MonadIO m => Async a -> Async b -> m ()
- data Conc (m :: Type -> Type) a
- data ConcException = EmptyWithNoAlternative
- newtype Concurrently (m :: Type -> Type) a = Concurrently {
- runConcurrently :: m a
- asyncBound :: MonadUnliftIO m => m a -> m (Async a)
- asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a)
- asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. m b -> m b) -> m a) -> m (Async a)
- asyncWithUnmask :: MonadUnliftIO m => ((forall b. m b -> m b) -> m a) -> m (Async a)
- cancel :: MonadIO m => Async a -> m ()
- cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m ()
- conc :: m a -> Conc m a
- concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b)
- concurrently_ :: MonadUnliftIO m => m a -> m b -> m ()
- forConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b)
- forConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m ()
- mapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b)
- mapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m ()
- poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a))
- pooledForConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b)
- pooledForConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> t a -> (a -> m b) -> m (t b)
- pooledForConcurrentlyN_ :: (MonadUnliftIO m, Foldable t) => Int -> t a -> (a -> m b) -> m ()
- pooledForConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m ()
- pooledMapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b)
- pooledMapConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> (a -> m b) -> t a -> m (t b)
- pooledMapConcurrentlyN_ :: (MonadUnliftIO m, Foldable f) => Int -> (a -> m b) -> f a -> m ()
- pooledMapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m ()
- pooledReplicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a]
- pooledReplicateConcurrentlyN :: MonadUnliftIO m => Int -> Int -> m a -> m [a]
- pooledReplicateConcurrentlyN_ :: MonadUnliftIO m => Int -> Int -> m a -> m ()
- pooledReplicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m ()
- race :: MonadUnliftIO m => m a -> m b -> m (Either a b)
- race_ :: MonadUnliftIO m => m a -> m b -> m ()
- replicateConcurrently :: MonadUnliftIO f => Int -> f a -> f [a]
- replicateConcurrently_ :: (Applicative m, MonadUnliftIO m) => Int -> m a -> m ()
- runConc :: MonadUnliftIO m => Conc m a -> m a
- uninterruptibleCancel :: MonadIO m => Async a -> m ()
- wait :: MonadIO m => Async a -> m a
- waitAny :: MonadIO m => [Async a] -> m (Async a, a)
- waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a)
- waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)
- waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)
- waitBoth :: MonadIO m => Async a -> Async b -> m (a, b)
- waitCatch :: MonadIO m => Async a -> m (Either SomeException a)
- waitEither :: MonadIO m => Async a -> Async b -> m (Either a b)
- waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a b)
- waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))
- waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))
- waitEither_ :: MonadIO m => Async a -> Async b -> m ()
- withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b
- withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b
- withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b
- withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b
- withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b
- pollSTM :: Async a -> STM (Maybe (Either SomeException a))
- waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a)
- waitAnySTM :: [Async a] -> STM (Async a, a)
- waitBothSTM :: Async a -> Async b -> STM (a, b)
- waitCatchSTM :: Async a -> STM (Either SomeException a)
- waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b))
- waitEitherSTM :: Async a -> Async b -> STM (Either a b)
- waitEitherSTM_ :: Async a -> Async b -> STM ()
- waitSTM :: Async a -> STM a
- data AsyncCancelled = AsyncCancelled
- data STM a
- atomically :: MonadIO m => STM a -> m a
- orElse :: STM a -> STM a -> STM a
- checkSTM :: Bool -> STM ()
- mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a))
- mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a))
- newBroadcastTChanIO :: MonadIO m => m (TChan a)
- newEmptyTMVarIO :: MonadIO m => m (TMVar a)
- newTBQueueIO :: MonadIO m => Natural -> m (TBQueue a)
- newTChanIO :: MonadIO m => m (TChan a)
- newTMVarIO :: MonadIO m => a -> m (TMVar a)
- newTQueueIO :: MonadIO m => m (TQueue a)
- newTVarIO :: MonadIO m => a -> m (TVar a)
- readTVarIO :: MonadIO m => TVar a -> m a
- registerDelay :: MonadIO m => Int -> m (TVar Bool)
- retrySTM :: STM a
- newTVar :: a -> STM (TVar a)
- readTVar :: TVar a -> STM a
- writeTVar :: TVar a -> a -> STM ()
- flushTBQueue :: TBQueue a -> STM [a]
- isEmptyTBQueue :: TBQueue a -> STM Bool
- isFullTBQueue :: TBQueue a -> STM Bool
- lengthTBQueue :: TBQueue a -> STM Natural
- newTBQueue :: Natural -> STM (TBQueue a)
- peekTBQueue :: TBQueue a -> STM a
- readTBQueue :: TBQueue a -> STM a
- tryPeekTBQueue :: TBQueue a -> STM (Maybe a)
- tryReadTBQueue :: TBQueue a -> STM (Maybe a)
- unGetTBQueue :: TBQueue a -> a -> STM ()
- writeTBQueue :: TBQueue a -> a -> STM ()
- cloneTChan :: TChan a -> STM (TChan a)
- dupTChan :: TChan a -> STM (TChan a)
- isEmptyTChan :: TChan a -> STM Bool
- newBroadcastTChan :: STM (TChan a)
- newTChan :: STM (TChan a)
- peekTChan :: TChan a -> STM a
- readTChan :: TChan a -> STM a
- tryPeekTChan :: TChan a -> STM (Maybe a)
- tryReadTChan :: TChan a -> STM (Maybe a)
- unGetTChan :: TChan a -> a -> STM ()
- writeTChan :: TChan a -> a -> STM ()
- isEmptyTMVar :: TMVar a -> STM Bool
- newEmptyTMVar :: STM (TMVar a)
- newTMVar :: a -> STM (TMVar a)
- putTMVar :: TMVar a -> a -> STM ()
- readTMVar :: TMVar a -> STM a
- swapTMVar :: TMVar a -> a -> STM a
- takeTMVar :: TMVar a -> STM a
- tryPutTMVar :: TMVar a -> a -> STM Bool
- tryReadTMVar :: TMVar a -> STM (Maybe a)
- tryTakeTMVar :: TMVar a -> STM (Maybe a)
- writeTMVar :: TMVar a -> a -> STM ()
- isEmptyTQueue :: TQueue a -> STM Bool
- newTQueue :: STM (TQueue a)
- peekTQueue :: TQueue a -> STM a
- readTQueue :: TQueue a -> STM a
- tryPeekTQueue :: TQueue a -> STM (Maybe a)
- tryReadTQueue :: TQueue a -> STM (Maybe a)
- unGetTQueue :: TQueue a -> a -> STM ()
- writeTQueue :: TQueue a -> a -> STM ()
- modifyTVar :: TVar a -> (a -> a) -> STM ()
- modifyTVar' :: TVar a -> (a -> a) -> STM ()
- stateTVar :: TVar s -> (s -> (a, s)) -> STM a
- swapTVar :: TVar a -> a -> STM a
- data TVar a
- data TBQueue a
- data TChan a
- data TMVar a
- data TQueue a
- data Chan a
- dupChan :: MonadIO m => Chan a -> m (Chan a)
- getChanContents :: MonadIO m => Chan a -> m [a]
- newChan :: MonadIO m => m (Chan a)
- readChan :: MonadIO m => Chan a -> m a
- writeChan :: MonadIO m => Chan a -> a -> m ()
- writeList2Chan :: MonadIO m => Chan a -> [a] -> m ()
- timeout :: MonadUnliftIO m => Int -> m a -> m (Maybe a)
- class (Typeable e, Show e) => Exception e where
- toException :: e -> SomeException
- fromException :: SomeException -> Maybe e
- displayException :: e -> String
- backtraceDesired :: e -> Bool
- assert :: Bool -> a -> a
- class Typeable (a :: k)
- data SomeException = (Exception e, HasExceptionContext) => SomeException e
- data IOException
- throwIO :: (MonadIO m, Exception e) => e -> m a
- bracket :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c
- catch :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a
- catchAny :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a
- evaluate :: MonadIO m => a -> m a
- finally :: MonadUnliftIO m => m a -> m b -> m a
- mask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m b) -> m b
- mask_ :: MonadUnliftIO m => m a -> m a
- onException :: MonadUnliftIO m => m a -> m b -> m a
- uninterruptibleMask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m b) -> m b
- uninterruptibleMask_ :: MonadUnliftIO m => m a -> m a
- data StringException = StringException String CallStack
- bracketOnError :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c
- bracketOnError_ :: MonadUnliftIO m => m a -> m b -> m c -> m c
- bracket_ :: MonadUnliftIO m => m a -> m b -> m c -> m c
- catchAnyDeep :: (NFData a, MonadUnliftIO m) => m a -> (SomeException -> m a) -> m a
- catchDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> (e -> m a) -> m a
- catchIO :: MonadUnliftIO m => m a -> (IOException -> m a) -> m a
- catchJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> m a -> (b -> m a) -> m a
- catchSyncOrAsync :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a
- catches :: MonadUnliftIO m => m a -> [Handler m a] -> m a
- catchesDeep :: (MonadUnliftIO m, NFData a) => m a -> [Handler m a] -> m a
- evaluateDeep :: (MonadIO m, NFData a) => a -> m a
- fromEither :: (Exception e, MonadIO m) => Either e a -> m a
- fromEitherIO :: (Exception e, MonadIO m) => IO (Either e a) -> m a
- fromEitherM :: (Exception e, MonadIO m) => m (Either e a) -> m a
- fromExceptionUnwrap :: Exception e => SomeException -> Maybe e
- handle :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a
- handleAny :: MonadUnliftIO m => (SomeException -> m a) -> m a -> m a
- handleAnyDeep :: (MonadUnliftIO m, NFData a) => (SomeException -> m a) -> m a -> m a
- handleDeep :: (MonadUnliftIO m, Exception e, NFData a) => (e -> m a) -> m a -> m a
- handleIO :: MonadUnliftIO m => (IOException -> m a) -> m a -> m a
- handleJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a
- handleSyncOrAsync :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a
- impureThrow :: Exception e => e -> a
- isAsyncException :: Exception e => e -> Bool
- isSyncException :: Exception e => e -> Bool
- mapExceptionM :: (Exception e1, Exception e2, MonadUnliftIO m) => (e1 -> e2) -> m a -> m a
- pureTry :: a -> Either SomeException a
- pureTryDeep :: NFData a => a -> Either SomeException a
- stringException :: HasCallStack => String -> StringException
- throwString :: (MonadIO m, HasCallStack) => String -> m a
- throwTo :: (Exception e, MonadIO m) => ThreadId -> e -> m ()
- toAsyncException :: Exception e => e -> SomeException
- toSyncException :: Exception e => e -> SomeException
- try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a)
- tryAny :: MonadUnliftIO m => m a -> m (Either SomeException a)
- tryAnyDeep :: (MonadUnliftIO m, NFData a) => m a -> m (Either SomeException a)
- tryDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> m (Either e a)
- tryIO :: MonadUnliftIO m => m a -> m (Either IOException a)
- tryJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> m a -> m (Either b a)
- trySyncOrAsync :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a)
- withException :: (MonadUnliftIO m, Exception e) => m a -> (e -> m b) -> m a
- asyncExceptionFromException :: Exception e => SomeException -> Maybe e
- asyncExceptionToException :: Exception e => e -> SomeException
- data Handler (m :: Type -> Type) a = Exception e => Handler (e -> m a)
- data SomeAsyncException = Exception e => SomeAsyncException e
- data AsyncExceptionWrapper = Exception e => AsyncExceptionWrapper e
- data SyncExceptionWrapper = Exception e => SyncExceptionWrapper e
- throwM :: (MonadThrow m, HasCallStack, Exception e) => e -> m a
- withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a
- data Handle
- data IOMode
- stdin :: Handle
- stdout :: Handle
- stderr :: Handle
- getMonotonicTime :: MonadIO m => m Double
- hClose :: MonadIO m => Handle -> m ()
- hFileSize :: MonadIO m => Handle -> m Integer
- hFlush :: MonadIO m => Handle -> m ()
- hGetBuffering :: MonadIO m => Handle -> m BufferMode
- hGetEcho :: MonadIO m => Handle -> m Bool
- hIsClosed :: MonadIO m => Handle -> m Bool
- hIsEOF :: MonadIO m => Handle -> m Bool
- hIsOpen :: MonadIO m => Handle -> m Bool
- hIsReadable :: MonadIO m => Handle -> m Bool
- hIsSeekable :: MonadIO m => Handle -> m Bool
- hIsTerminalDevice :: MonadIO m => Handle -> m Bool
- hIsWritable :: MonadIO m => Handle -> m Bool
- hReady :: MonadIO m => Handle -> m Bool
- hSeek :: MonadIO m => Handle -> SeekMode -> Integer -> m ()
- hSetBuffering :: MonadIO m => Handle -> BufferMode -> m ()
- hSetEcho :: MonadIO m => Handle -> Bool -> m ()
- hSetFileSize :: MonadIO m => Handle -> Integer -> m ()
- hTell :: MonadIO m => Handle -> m Integer
- hWaitForInput :: MonadIO m => Handle -> Int -> m Bool
- openFile :: MonadIO m => FilePath -> IOMode -> m Handle
- withFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a
- data SeekMode
- data BufferMode
- withSystemTempDirectory :: MonadUnliftIO m => String -> (FilePath -> m a) -> m a
- withSystemTempFile :: MonadUnliftIO m => String -> (FilePath -> Handle -> m a) -> m a
- withTempDirectory :: MonadUnliftIO m => FilePath -> String -> (FilePath -> m a) -> m a
- withTempFile :: MonadUnliftIO m => FilePath -> String -> (FilePath -> Handle -> m a) -> m a
- withLazyFile :: MonadUnliftIO m => FilePath -> (ByteString -> m a) -> m a
- withLazyFileUtf8 :: MonadUnliftIO m => FilePath -> (Text -> m a) -> m a
- readFileBinary :: MonadIO m => FilePath -> m ByteString
- writeFileBinary :: MonadIO m => FilePath -> ByteString -> m ()
- readFileUtf8 :: MonadIO m => FilePath -> m Text
- writeFileUtf8 :: MonadIO m => FilePath -> Text -> m ()
- hPutBuilder :: MonadIO m => Handle -> Builder -> m ()
- exitWith :: MonadIO m => ExitCode -> m a
- exitFailure :: MonadIO m => m a
- exitSuccess :: MonadIO m => m a
- data ExitCode
- data SomeRef a
- mapRIO :: (outer -> inner) -> RIO inner a -> RIO outer a
- class HasStateRef s env | env -> s where
- class HasWriteRef w env | env -> w where
- newSomeRef :: MonadIO m => a -> m (SomeRef a)
- newUnboxedSomeRef :: (MonadIO m, Unbox a) => a -> m (SomeRef a)
- readSomeRef :: MonadIO m => SomeRef a -> m a
- writeSomeRef :: MonadIO m => SomeRef a -> a -> m ()
- modifySomeRef :: MonadIO m => SomeRef a -> (a -> a) -> m ()
- data URef s a
- type IOURef = URef (PrimState IO)
- newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a)
- readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a
- writeURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> a -> m ()
- modifyURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> (a -> a) -> m ()
- data IORef a
- atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b
- atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b
- atomicWriteIORef :: MonadIO m => IORef a -> a -> m ()
- mkWeakIORef :: MonadUnliftIO m => IORef a -> m () -> m (Weak (IORef a))
- modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m ()
- modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m ()
- newIORef :: MonadIO m => a -> m (IORef a)
- readIORef :: MonadIO m => IORef a -> m a
- writeIORef :: MonadIO m => IORef a -> a -> m ()
- data MVar a
- isEmptyMVar :: MonadIO m => MVar a -> m Bool
- mkWeakMVar :: MonadUnliftIO m => MVar a -> m () -> m (Weak (MVar a))
- modifyMVar :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b
- modifyMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b
- modifyMVarMasked_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()
- modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()
- newEmptyMVar :: MonadIO m => m (MVar a)
- newMVar :: MonadIO m => a -> m (MVar a)
- putMVar :: MonadIO m => MVar a -> a -> m ()
- readMVar :: MonadIO m => MVar a -> m a
- swapMVar :: MonadIO m => MVar a -> a -> m a
- takeMVar :: MonadIO m => MVar a -> m a
- tryPutMVar :: MonadIO m => MVar a -> a -> m Bool
- tryReadMVar :: MonadIO m => MVar a -> m (Maybe a)
- tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a)
- withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b
- withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b
- data QSem
- newQSem :: MonadIO m => Int -> m QSem
- signalQSem :: MonadIO m => QSem -> m ()
- waitQSem :: MonadIO m => QSem -> m ()
- withQSem :: MonadUnliftIO m => QSem -> m a -> m a
- data QSemN
- newQSemN :: MonadIO m => Int -> m QSemN
- signalQSemN :: MonadIO m => QSemN -> Int -> m ()
- waitQSemN :: MonadIO m => QSemN -> Int -> m ()
- withQSemN :: MonadUnliftIO m => QSemN -> Int -> m a -> m a
- data Memoized a
- memoizeMVar :: MonadUnliftIO m => m a -> m (Memoized a)
- memoizeRef :: MonadUnliftIO m => m a -> m (Memoized a)
- runMemoized :: MonadIO m => Memoized a -> m a
- module RIO.Deque
- trace :: Text -> a -> a
- traceId :: Text -> Text
- traceIO :: MonadIO m => Text -> m ()
- traceM :: Applicative f => Text -> f ()
- traceEvent :: Text -> a -> a
- traceEventIO :: MonadIO m => Text -> m ()
- traceMarker :: Text -> a -> a
- traceMarkerIO :: MonadIO m => Text -> m ()
- traceStack :: Text -> a -> a
- traceShow :: Show a => a -> b -> b
- traceShowId :: Show a => a -> a
- traceShowIO :: (Show a, MonadIO m) => a -> m ()
- traceShowM :: (Show a, Applicative f) => a -> f ()
- traceShowEvent :: Show a => a -> b -> b
- traceShowEventIO :: (Show a, MonadIO m) => a -> m ()
- traceShowMarker :: Show a => a -> b -> b
- traceShowMarkerIO :: (Show a, MonadIO m) => a -> m ()
- traceShowStack :: Show a => a -> b -> b
- traceDisplay :: Display a => a -> b -> b
- traceDisplayId :: Display a => a -> a
- traceDisplayIO :: (Display a, MonadIO m) => a -> m ()
- traceDisplayM :: (Display a, Applicative f) => a -> f ()
- traceDisplayEvent :: Display a => a -> b -> b
- traceDisplayEventIO :: (Display a, MonadIO m) => a -> m ()
- traceDisplayMarker :: Display a => a -> b -> b
- traceDisplayMarkerIO :: (Display a, MonadIO m) => a -> m ()
- traceDisplayStack :: Display a => a -> b -> b
Custom Prelude
One of the core features of rio is that it can be used as a Prelude
replacement. Therefore it is best to disable the default Prelude with:
NoImplicitPrelude
pragma:
{-# LANGUAGE NoImplicitPrelude #-}
import RIOSome functions not exported here can be found in RIO.Partial:
fromJust, read, toEnum, pred, succ.
module RIO.Prelude
module RIO.Prelude.Types
The RIO Monad
The Reader+IO monad. This is different from a ReaderT because:
- It's not a transformer, it hardcodes IO for simpler usage and error messages.
- Instances of typeclasses like
MonadLoggerare implemented using classes defined on the environment, instead of using an underlying monad.
Instances
| MonadReader env (RIO env) Source # | |
| HasStateRef s env => MonadState s (RIO env) Source # | |
| (Monoid w, HasWriteRef w env) => MonadWriter w (RIO env) Source # | |
| MonadIO (RIO env) Source # | |
Defined in RIO.Prelude.RIO | |
| MonadThrow (RIO env) Source # | |
Defined in RIO.Prelude.RIO Methods throwM :: (HasCallStack, Exception e) => e -> RIO env a # | |
| Applicative (RIO env) Source # | |
| Functor (RIO env) Source # | |
| Monad (RIO env) Source # | |
| PrimMonad (RIO env) Source # | |
| MonadUnliftIO (RIO env) Source # | |
Defined in RIO.Prelude.RIO | |
| Monoid a => Monoid (RIO env a) Source # | |
| Semigroup a => Semigroup (RIO env a) Source # | |
| type PrimState (RIO env) Source # | |
Defined in RIO.Prelude.RIO | |
liftRIO :: (MonadIO m, MonadReader env m) => RIO env a -> m a Source #
Abstract RIO to an arbitrary MonadReader instance, which can handle IO.
Since: 0.0.1.0
runRIO :: MonadIO m => env -> RIO env a -> m a Source #
Using the environment run in IO the action that requires that environment.
Since: 0.0.1.0
SimpleApp
If all you need is just some default environment that does basic logging and allows
spawning processes, then you can use SimpleApp:
{-# LANGUAGE OverloadedStrings #-}
module Main where
main :: IO ()
main =
runSimpleApp $ do
logInfo "Hello World!"Note the OverloadedStrings extension, which is enabled to simplify logging.
module RIO.Prelude.Simple
MonadIO and MonadUnliftIO
class Monad m => MonadIO (m :: Type -> Type) where #
Instances
class MonadIO m => MonadUnliftIO (m :: Type -> Type) where #
Methods
withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b #
Instances
| MonadUnliftIO IO | |
Defined in Control.Monad.IO.Unlift | |
| MonadUnliftIO (RIO env) Source # | |
Defined in RIO.Prelude.RIO | |
| MonadUnliftIO m => MonadUnliftIO (IdentityT m) | |
Defined in Control.Monad.IO.Unlift Methods withRunInIO :: ((forall a. IdentityT m a -> IO a) -> IO b) -> IdentityT m b # | |
| MonadUnliftIO m => MonadUnliftIO (ReaderT r m) | |
Defined in Control.Monad.IO.Unlift | |
askRunInIO :: MonadUnliftIO m => m (m a -> IO a) #
askUnliftIO :: MonadUnliftIO m => m (UnliftIO m) #
liftIOOp :: MonadUnliftIO m => (IO a -> IO b) -> m a -> m b #
toIO :: MonadUnliftIO m => m a -> m (IO a) #
withUnliftIO :: MonadUnliftIO m => (UnliftIO m -> IO a) -> m a #
wrappedWithRunInIO :: MonadUnliftIO n => (n b -> m b) -> (forall a. m a -> n a) -> ((forall a. m a -> IO a) -> IO b) -> m b #
Logger
The logging system in RIO is built upon "log functions", which are accessed in RIO's environment via a class like "has log function". There are two provided:
- In the common case: for logging plain text (via
Utf8Builder) efficiently, there isLogFunc, which can be created viawithLogFunc, and is accessed viaHasLogFunc. This provides all the classical logging facilities: timestamped text output with log levels and colors (if terminal-supported) to the terminal. We log output vialogInfo,logDebug, etc. - In the advanced case: where logging takes on a more semantic
meaning and the logs need to be digested, acted upon, translated
or serialized upstream (to e.g. a JSON logging server), we have
GLogFunc(as in "generic log function"), and is accessed viaHasGLogFunc. In this case, we log output viaglog. See the Type-generic logger section for more information.
withLogFunc :: MonadUnliftIO m => LogOptions -> (LogFunc -> m a) -> m a Source #
Given a LogOptions value, run the given function with the
specified LogFunc. A common way to use this function is:
let isVerbose = False -- get from the command line instead
logOptions' <- logOptionsHandle stderr isVerbose
let logOptions = setLogUseTime True logOptions'
withLogFunc logOptions $ \lf -> do
let app = App -- application specific environment
{ appLogFunc = lf
, appOtherStuff = ...
}
runRIO app $ do
logInfo "Starting app"
myApp
Since: 0.0.0.0
newLogFunc :: (MonadIO n, MonadIO m) => LogOptions -> n (LogFunc, m ()) Source #
Given a LogOptions value, returns both a new LogFunc and a sub-routine that
disposes it.
Intended for use if you want to deal with the teardown of LogFunc yourself,
otherwise prefer the withLogFunc function instead.
Since: 0.1.3.0
A logging function, wrapped in a newtype for better error messages.
An implementation may choose any behavior of this value it wishes, including printing to standard output or no action at all.
Since: 0.0.0.0
class HasLogFunc env where Source #
Environment values with a logging function.
Since: 0.0.0.0
Instances
Arguments
| :: MonadIO m | |
| => Handle | |
| -> Bool | Verbose Flag |
| -> m LogOptions |
Create a LogOptions value from the given Handle and whether
to perform verbose logging or not. Individiual settings can be
overridden using appropriate set functions.
Logging output is guaranteed to be non-interleaved only for a
UTF-8 Handle in a multi-thread environment.
When Verbose Flag is True, the following happens:
setLogVerboseFormatis called withTruesetLogUseColoris called withTrue(except on Windows)setLogUseLocis called withTruesetLogUseTimeis called withTruesetLogMinLevelis called withDebuglog level
Since: 0.0.0.0
data LogOptions Source #
Configuration for how to create a LogFunc. Intended to be used
with the withLogFunc function.
Since: 0.0.0.0
setLogMinLevel :: LogLevel -> LogOptions -> LogOptions Source #
Set the minimum log level. Messages below this level will not be printed.
Default: in verbose mode, LevelDebug. Otherwise, LevelInfo.
Since: 0.0.0.0
setLogMinLevelIO :: IO LogLevel -> LogOptions -> LogOptions Source #
Refer to setLogMinLevel. This modifier allows to alter the verbose format
value dynamically at runtime.
Default: in verbose mode, LevelDebug. Otherwise, LevelInfo.
Since: 0.1.3.0
setLogVerboseFormat :: Bool -> LogOptions -> LogOptions Source #
Use the verbose format for printing log messages.
Default: follows the value of the verbose flag.
Since: 0.0.0.0
setLogVerboseFormatIO :: IO Bool -> LogOptions -> LogOptions Source #
Refer to setLogVerboseFormat. This modifier allows to alter the verbose
format value dynamically at runtime.
Default: follows the value of the verbose flag.
Since: 0.1.3.0
setLogTerminal :: Bool -> LogOptions -> LogOptions Source #
Do we treat output as a terminal. If True, we will enable
sticky logging functionality.
Default: checks if the Handle provided to logOptionsHandle is a
terminal with hIsTerminalDevice.
Since: 0.0.0.0
setLogUseTime :: Bool -> LogOptions -> LogOptions Source #
setLogUseColor :: Bool -> LogOptions -> LogOptions Source #
setLogUseLoc :: Bool -> LogOptions -> LogOptions Source #
setLogFormat :: (Utf8Builder -> Utf8Builder) -> LogOptions -> LogOptions Source #
setLogLevelColors :: (LogLevel -> Utf8Builder) -> LogOptions -> LogOptions Source #
ANSI color codes for LogLevel in the log output.
Default: LevelDebug = "\ESC[32m" -- Green
LevelInfo = "\ESC[34m" -- Blue
LevelWarn = "\ESC[33m" -- Yellow
LevelError = "\ESC[31m" -- Red
LevelOther _ = "\ESC[35m" -- Magenta
Since: 0.1.18.0
setLogSecondaryColor :: Utf8Builder -> LogOptions -> LogOptions Source #
ANSI color codes for secondary content in the log output.
Default: "\ESC[90m" -- Bright black (gray)
Since: 0.1.18.0
Arguments
| :: (Int -> Utf8Builder) | This should be a total function. |
| -> LogOptions | |
| -> LogOptions |
logDebug :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () Source #
Log a debug level message with no source.
Since: 0.0.0.0
logInfo :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () Source #
Log an info level message with no source.
Since: 0.0.0.0
logWarn :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () Source #
Log a warn level message with no source.
Since: 0.0.0.0
logError :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () Source #
Log an error level message with no source.
Since: 0.0.0.0
Arguments
| :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) | |
| => Text | level |
| -> Utf8Builder | |
| -> m () |
Log a message with the specified textual level and no source.
Since: 0.0.0.0
logSticky :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m () Source #
Write a "sticky" line to the terminal. Any subsequent lines will
overwrite this one, and that same line will be repeated below
again. In other words, the line sticks at the bottom of the output
forever. Running this function again will replace the sticky line
with a new sticky line. When you want to get rid of the sticky
line, run logStickyDone.
Note that not all LogFunc implementations will support sticky
messages as described. However, the withLogFunc implementation
provided by this module does.
Since: 0.0.0.0
logStickyDone :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m () Source #
This will print out the given message with a newline and disable
any further stickiness of the line until a new call to logSticky
happens.
Since: 0.0.0.0
logDebugS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () Source #
Log a debug level message with the given source.
Since: 0.0.0.0
logInfoS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () Source #
Log an info level message with the given source.
Since: 0.0.0.0
logWarnS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () Source #
Log a warn level message with the given source.
Since: 0.0.0.0
logErrorS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () Source #
Log an error level message with the given source.
Since: 0.0.0.0
Arguments
| :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) | |
| => Text | level |
| -> LogSource | |
| -> Utf8Builder | |
| -> m () |
Log a message with the specified textual level and the given source.
Since: 0.0.0.0
logGeneric :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> LogLevel -> Utf8Builder -> m () Source #
Generic, basic function for creating other logging functions.
Since: 0.0.0.0
mkLogFunc :: (CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()) -> LogFunc Source #
Create a LogFunc from the given function.
Since: 0.0.0.0
logOptionsMemory :: MonadIO m => m (IORef Builder, LogOptions) Source #
Create a LogOptions value which will store its data in
memory. This is primarily intended for testing purposes. This will
return both a LogOptions value and an IORef containing the
resulting Builder value.
This will default to non-verbose settings and assume there is a
terminal attached. These assumptions can be overridden using the
appropriate set functions.
Since: 0.0.0.0
The log level of a message.
Since: 0.0.0.0
Constructors
| LevelDebug | |
| LevelInfo | |
| LevelWarn | |
| LevelError | |
| LevelOther !Text |
type LogSource = Text Source #
Where in the application a log message came from. Used for display purposes only.
Since: 0.0.0.0
Instances
| NFData CallStack | |
Defined in Control.DeepSeq | |
| IsList CallStack | |
| Show CallStack | |
| type Item CallStack | |
Defined in GHC.Internal.IsList | |
displayCallStack :: CallStack -> Utf8Builder Source #
Convert a CallStack value into a Utf8Builder indicating
the first source location.
TODO Consider showing the entire call stack instead.
Since: 0.0.0.0
noLogging :: (HasLogFunc env, MonadReader env m) => m a -> m a Source #
Disable logging capabilities in a given sub-routine
Intended to skip logging in general purpose implementations, where secrets might be logged accidently.
Since: 0.1.5.0
logFuncUseColorL :: HasLogFunc env => SimpleGetter env Bool Source #
Is the log func configured to use color output?
Intended for use by code which wants to optionally add additional color to its log messages.
Since: 0.1.0.0
logFuncLogLevelColorsL :: HasLogFunc env => SimpleGetter env (LogLevel -> Utf8Builder) Source #
What color is the log func configured to use for each LogLevel?
Intended for use by code which wants to optionally add additional color to its log messages.
Since: 0.1.18.0
logFuncSecondaryColorL :: HasLogFunc env => SimpleGetter env Utf8Builder Source #
What color is the log func configured to use for secondary content?
Intended for use by code which wants to optionally add additional color to its log messages.
Since: 0.1.18.0
logFuncAccentColorsL :: HasLogFunc env => SimpleGetter env (Int -> Utf8Builder) Source #
What accent colors, indexed by Int, is the log func configured to use?
Intended for use by code which wants to optionally add additional color to its log messages.
Since: 0.1.18.0
glog :: (MonadIO m, HasCallStack, HasGLogFunc env, MonadReader env m) => GMsg env -> m () Source #
Log a value generically.
Since: 0.1.13.0
A generic logger of some type msg.
Your GLocFunc can re-use the existing classical logging framework
of RIO, and/or implement additional transforms,
filters. Alternatively, you may log to a JSON source in a database,
or anywhere else as needed. You can decide how to log levels or
severities based on the constructors in your type. You will
normally determine this in your main app entry point.
Since: 0.1.13.0
Instances
| Contravariant GLogFunc Source # | Use this instance to wrap sub-loggers via The Since: 0.1.13.0 |
| Monoid (GLogFunc msg) Source # |
Since: 0.1.13.0 |
| Semigroup (GLogFunc msg) Source # | Perform both sets of actions per log entry. Since: 0.1.13.0 |
| HasGLogFunc (GLogFunc msg) Source # | Quick way to run a RIO that only has a logger in its environment. Since: 0.1.13.0 |
| type GMsg (GLogFunc msg) Source # | |
Defined in RIO.Prelude.Logger | |
gLogFuncClassic :: (HasLogLevel msg, HasLogSource msg, Display msg) => LogFunc -> GLogFunc msg Source #
mkGLogFunc :: (CallStack -> msg -> IO ()) -> GLogFunc msg Source #
Make a custom generic logger. With this you could, for example, write to a database or a log digestion service. For example:
mkGLogFunc (\stack msg -> send (Data.Aeson.encode (JsonLog stack msg)))
Since: 0.1.13.0
contramapMaybeGLogFunc :: (a -> Maybe b) -> GLogFunc b -> GLogFunc a Source #
A vesion of contramapMaybeGLogFunc which supports filering.
Since: 0.1.13.0
contramapGLogFunc :: (a -> b) -> GLogFunc b -> GLogFunc a Source #
A contramap. Use this to wrap sub-loggers via mapRIO.
If you are on base > 4.12.0, you can just use contramap.
Since: 0.1.13.0
class HasGLogFunc env where Source #
An app is capable of generic logging if it implements this.
Since: 0.1.13.0
Instances
| HasGLogFunc (GLogFunc msg) Source # | Quick way to run a RIO that only has a logger in its environment. Since: 0.1.13.0 |
class HasLogLevel msg where Source #
Level, if any, of your logs. If unknown, use LogOther. Use for
your generic log data types that want to sit inside the classic log
framework.
Since: 0.1.13.0
Methods
getLogLevel :: msg -> LogLevel Source #
class HasLogSource msg where Source #
Source of a log. This can be whatever you want. Use for your generic log data types that want to sit inside the classic log framework.
Since: 0.1.13.0
Methods
getLogSource :: msg -> LogSource Source #
Display
class Display a where Source #
A typeclass for values which can be converted to a
Utf8Builder. The intention of this typeclass is to provide a
human-friendly display of the data.
Since: 0.1.0.0
Minimal complete definition
Instances
newtype Utf8Builder Source #
A builder of binary data, with the invariant that the underlying data is supposed to be UTF-8 encoded.
Since: 0.1.0.0
Constructors
| Utf8Builder | |
Fields | |
Instances
| Monoid Utf8Builder Source # | |
Defined in RIO.Prelude.Display Methods mempty :: Utf8Builder # mappend :: Utf8Builder -> Utf8Builder -> Utf8Builder # mconcat :: [Utf8Builder] -> Utf8Builder # | |
| Semigroup Utf8Builder Source # | |
Defined in RIO.Prelude.Display Methods (<>) :: Utf8Builder -> Utf8Builder -> Utf8Builder # sconcat :: NonEmpty Utf8Builder -> Utf8Builder stimes :: Integral b => b -> Utf8Builder -> Utf8Builder | |
| IsString Utf8Builder Source # | Since: 0.1.0.0 |
Defined in RIO.Prelude.Display Methods fromString :: String -> Utf8Builder # | |
| Display Utf8Builder Source # | Since: 0.1.0.0 |
Defined in RIO.Prelude.Display | |
displayShow :: Show a => a -> Utf8Builder Source #
Use the Show instance for a value to convert it to a
Utf8Builder.
Since: 0.1.0.0
utf8BuilderToText :: Utf8Builder -> Text Source #
Convert a Utf8Builder value into a strict Text.
Since: 0.1.0.0
utf8BuilderToLazyText :: Utf8Builder -> Text Source #
Convert a Utf8Builder value into a lazy Text.
Since: 0.1.0.0
displayBytesUtf8 :: ByteString -> Utf8Builder Source #
Convert a ByteString into a Utf8Builder.
NOTE This function performs no checks to ensure that the data is, in fact, UTF8 encoded. If you provide non-UTF8 data, later functions may fail.
Since: 0.1.0.0
writeFileUtf8Builder :: MonadIO m => FilePath -> Utf8Builder -> m () Source #
Write the given Utf8Builder value to a file.
Since: 0.1.0.0
Optics
microlens-based Lenses, Traversals, etc.
view :: MonadReader s m => Getting a s a -> m a #
preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a) #
type SimpleGetter s a = forall r. Getting r s a #
to :: (s -> a) -> SimpleGetter s a #
Concurrency
Instances
| NFData ThreadId | |
Defined in Control.DeepSeq | |
| Show ThreadId | |
| Eq ThreadId | |
| Ord ThreadId | |
Defined in GHC.Internal.Conc.Sync | |
| Hashable ThreadId | |
Defined in Data.Hashable.Class | |
myThreadId :: MonadIO m => m ThreadId #
isCurrentThreadBound :: MonadIO m => m Bool #
threadWaitRead :: MonadIO m => Fd -> m () #
threadWaitWrite :: MonadIO m => Fd -> m () #
threadDelay :: MonadIO m => Int -> m () #
yieldThread :: MonadIO m => m () Source #
Async
async :: MonadUnliftIO m => m a -> m (Async a) #
Instances
| Functor Async | |
| Eq (Async a) | |
| Ord (Async a) | |
Defined in Control.Concurrent.Async.Internal | |
| Hashable (Async a) | |
Defined in Control.Concurrent.Async.Internal | |
data Conc (m :: Type -> Type) a #
Instances
| MonadUnliftIO m => Alternative (Conc m) | |
| MonadUnliftIO m => Applicative (Conc m) | |
| Functor m => Functor (Conc m) | |
| (Monoid a, MonadUnliftIO m) => Monoid (Conc m a) | |
| (MonadUnliftIO m, Semigroup a) => Semigroup (Conc m a) | |
data ConcException #
Constructors
| EmptyWithNoAlternative |
Instances
newtype Concurrently (m :: Type -> Type) a #
Constructors
| Concurrently | |
Fields
| |
Instances
| MonadUnliftIO m => Alternative (Concurrently m) | |
Defined in UnliftIO.Internals.Async Methods empty :: Concurrently m a (<|>) :: Concurrently m a -> Concurrently m a -> Concurrently m a # some :: Concurrently m a -> Concurrently m [a] # many :: Concurrently m a -> Concurrently m [a] # | |
| MonadUnliftIO m => Applicative (Concurrently m) | |
Defined in UnliftIO.Internals.Async Methods pure :: a -> Concurrently m a # (<*>) :: Concurrently m (a -> b) -> Concurrently m a -> Concurrently m b # liftA2 :: (a -> b -> c) -> Concurrently m a -> Concurrently m b -> Concurrently m c # (*>) :: Concurrently m a -> Concurrently m b -> Concurrently m b # (<*) :: Concurrently m a -> Concurrently m b -> Concurrently m a # | |
| Monad m => Functor (Concurrently m) | |
Defined in UnliftIO.Internals.Async Methods fmap :: (a -> b) -> Concurrently m a -> Concurrently m b # (<$) :: a -> Concurrently m b -> Concurrently m a # | |
| (Semigroup a, Monoid a, MonadUnliftIO m) => Monoid (Concurrently m a) | |
Defined in UnliftIO.Internals.Async Methods mempty :: Concurrently m a # mappend :: Concurrently m a -> Concurrently m a -> Concurrently m a # mconcat :: [Concurrently m a] -> Concurrently m a # | |
| (MonadUnliftIO m, Semigroup a) => Semigroup (Concurrently m a) | |
Defined in UnliftIO.Internals.Async Methods (<>) :: Concurrently m a -> Concurrently m a -> Concurrently m a # sconcat :: NonEmpty (Concurrently m a) -> Concurrently m a stimes :: Integral b => b -> Concurrently m a -> Concurrently m a | |
asyncBound :: MonadUnliftIO m => m a -> m (Async a) #
asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a) #
asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. m b -> m b) -> m a) -> m (Async a) #
asyncWithUnmask :: MonadUnliftIO m => ((forall b. m b -> m b) -> m a) -> m (Async a) #
cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m () #
concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b) #
concurrently_ :: MonadUnliftIO m => m a -> m b -> m () #
forConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b) #
forConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m () #
mapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b) #
mapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m () #
pooledForConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b) #
pooledForConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> t a -> (a -> m b) -> m (t b) #
pooledForConcurrentlyN_ :: (MonadUnliftIO m, Foldable t) => Int -> t a -> (a -> m b) -> m () #
pooledForConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m () #
pooledMapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b) #
pooledMapConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> (a -> m b) -> t a -> m (t b) #
pooledMapConcurrentlyN_ :: (MonadUnliftIO m, Foldable f) => Int -> (a -> m b) -> f a -> m () #
pooledMapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m () #
pooledReplicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a] #
pooledReplicateConcurrentlyN :: MonadUnliftIO m => Int -> Int -> m a -> m [a] #
pooledReplicateConcurrentlyN_ :: MonadUnliftIO m => Int -> Int -> m a -> m () #
pooledReplicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m () #
race :: MonadUnliftIO m => m a -> m b -> m (Either a b) #
race_ :: MonadUnliftIO m => m a -> m b -> m () #
replicateConcurrently :: MonadUnliftIO f => Int -> f a -> f [a] #
replicateConcurrently_ :: (Applicative m, MonadUnliftIO m) => Int -> m a -> m () #
runConc :: MonadUnliftIO m => Conc m a -> m a #
uninterruptibleCancel :: MonadIO m => Async a -> m () #
waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a) #
waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) #
waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) #
waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b)) #
waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b)) #
waitEither_ :: MonadIO m => Async a -> Async b -> m () #
withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b #
withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b #
withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b #
withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b #
withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b #
waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a) #
waitAnySTM :: [Async a] -> STM (Async a, a) #
waitBothSTM :: Async a -> Async b -> STM (a, b) #
waitCatchSTM :: Async a -> STM (Either SomeException a) #
waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b)) #
waitEitherSTM_ :: Async a -> Async b -> STM () #
data AsyncCancelled #
Constructors
| AsyncCancelled |
Instances
| Exception AsyncCancelled | |
Defined in Control.Concurrent.Async.Internal Methods toException :: AsyncCancelled -> SomeException # fromException :: SomeException -> Maybe AsyncCancelled # displayException :: AsyncCancelled -> String # backtraceDesired :: AsyncCancelled -> Bool # | |
| Show AsyncCancelled | |
Defined in Control.Concurrent.Async.Internal Methods showsPrec :: Int -> AsyncCancelled -> ShowS show :: AsyncCancelled -> String # showList :: [AsyncCancelled] -> ShowS | |
| Eq AsyncCancelled | |
Defined in Control.Concurrent.Async.Internal Methods (==) :: AsyncCancelled -> AsyncCancelled -> Bool # (/=) :: AsyncCancelled -> AsyncCancelled -> Bool # | |
STM
Instances
| MonadCatch STM | |
Defined in Control.Monad.Catch | |
| MonadThrow STM | |
Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> STM a # | |
| Alternative STM | |
| Applicative STM | |
| Functor STM | |
| Monad STM | |
| MonadPlus STM | |
| MonadFix STM | |
Defined in Control.Monad.STM | |
| Monoid a => Monoid (STM a) | |
| Semigroup a => Semigroup (STM a) | |
atomically :: MonadIO m => STM a -> m a #
mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a)) #
mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a)) #
newBroadcastTChanIO :: MonadIO m => m (TChan a) #
newEmptyTMVarIO :: MonadIO m => m (TMVar a) #
newTBQueueIO :: MonadIO m => Natural -> m (TBQueue a) #
newTChanIO :: MonadIO m => m (TChan a) #
newTMVarIO :: MonadIO m => a -> m (TMVar a) #
newTQueueIO :: MonadIO m => m (TQueue a) #
readTVarIO :: MonadIO m => TVar a -> m a #
flushTBQueue :: TBQueue a -> STM [a] #
isEmptyTBQueue :: TBQueue a -> STM Bool #
isFullTBQueue :: TBQueue a -> STM Bool #
lengthTBQueue :: TBQueue a -> STM Natural #
newTBQueue :: Natural -> STM (TBQueue a) #
peekTBQueue :: TBQueue a -> STM a #
readTBQueue :: TBQueue a -> STM a #
tryPeekTBQueue :: TBQueue a -> STM (Maybe a) #
tryReadTBQueue :: TBQueue a -> STM (Maybe a) #
unGetTBQueue :: TBQueue a -> a -> STM () #
writeTBQueue :: TBQueue a -> a -> STM () #
cloneTChan :: TChan a -> STM (TChan a) #
isEmptyTChan :: TChan a -> STM Bool #
newBroadcastTChan :: STM (TChan a) #
tryPeekTChan :: TChan a -> STM (Maybe a) #
tryReadTChan :: TChan a -> STM (Maybe a) #
unGetTChan :: TChan a -> a -> STM () #
writeTChan :: TChan a -> a -> STM () #
isEmptyTMVar :: TMVar a -> STM Bool #
newEmptyTMVar :: STM (TMVar a) #
tryPutTMVar :: TMVar a -> a -> STM Bool #
tryReadTMVar :: TMVar a -> STM (Maybe a) #
tryTakeTMVar :: TMVar a -> STM (Maybe a) #
writeTMVar :: TMVar a -> a -> STM () #
isEmptyTQueue :: TQueue a -> STM Bool #
peekTQueue :: TQueue a -> STM a #
readTQueue :: TQueue a -> STM a #
tryPeekTQueue :: TQueue a -> STM (Maybe a) #
tryReadTQueue :: TQueue a -> STM (Maybe a) #
unGetTQueue :: TQueue a -> a -> STM () #
writeTQueue :: TQueue a -> a -> STM () #
modifyTVar :: TVar a -> (a -> a) -> STM () #
modifyTVar' :: TVar a -> (a -> a) -> STM () #
Chan
getChanContents :: MonadIO m => Chan a -> m [a] #
writeList2Chan :: MonadIO m => Chan a -> [a] -> m () #
Timeout
timeout :: MonadUnliftIO m => Int -> m a -> m (Maybe a) #
Exceptions
class (Typeable e, Show e) => Exception e where #
Minimal complete definition
Nothing
Methods
toException :: e -> SomeException #
fromException :: SomeException -> Maybe e #
displayException :: e -> String #
backtraceDesired :: e -> Bool #
Instances
| Exception AsyncCancelled | |
Defined in Control.Concurrent.Async.Internal Methods toException :: AsyncCancelled -> SomeException # fromException :: SomeException -> Maybe AsyncCancelled # displayException :: AsyncCancelled -> String # backtraceDesired :: AsyncCancelled -> Bool # | |
| Exception ExceptionInLinkedThread | |
Defined in Control.Concurrent.Async.Internal Methods toException :: ExceptionInLinkedThread -> SomeException # fromException :: SomeException -> Maybe ExceptionInLinkedThread # displayException :: ExceptionInLinkedThread -> String # backtraceDesired :: ExceptionInLinkedThread -> Bool # | |
| Exception Timeout | |
Defined in System.Timeout Methods toException :: Timeout -> SomeException # fromException :: SomeException -> Maybe Timeout # displayException :: Timeout -> String # backtraceDesired :: Timeout -> Bool # | |
| Exception SizeOverflowException | |
Defined in Data.ByteString.Internal.Type Methods toException :: SizeOverflowException -> SomeException # fromException :: SomeException -> Maybe SizeOverflowException # displayException :: SizeOverflowException -> String # backtraceDesired :: SizeOverflowException -> Bool # | |
| Exception Void | |
Defined in GHC.Internal.Exception.Type Methods toException :: Void -> SomeException # fromException :: SomeException -> Maybe Void # displayException :: Void -> String # backtraceDesired :: Void -> Bool # | |
| Exception ArithException | |
Defined in GHC.Internal.Exception.Type Methods toException :: ArithException -> SomeException # fromException :: SomeException -> Maybe ArithException # displayException :: ArithException -> String # backtraceDesired :: ArithException -> Bool # | |
| Exception SomeException | |
Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # backtraceDesired :: SomeException -> Bool # | |
| Exception AllocationLimitExceeded | |
Defined in GHC.Internal.IO.Exception Methods toException :: AllocationLimitExceeded -> SomeException # fromException :: SomeException -> Maybe AllocationLimitExceeded # displayException :: AllocationLimitExceeded -> String # backtraceDesired :: AllocationLimitExceeded -> Bool # | |
| Exception ArrayException | |
Defined in GHC.Internal.IO.Exception Methods toException :: ArrayException -> SomeException # fromException :: SomeException -> Maybe ArrayException # displayException :: ArrayException -> String # backtraceDesired :: ArrayException -> Bool # | |
| Exception AssertionFailed | |
Defined in GHC.Internal.IO.Exception Methods toException :: AssertionFailed -> SomeException # fromException :: SomeException -> Maybe AssertionFailed # displayException :: AssertionFailed -> String # backtraceDesired :: AssertionFailed -> Bool # | |
| Exception AsyncException | |
Defined in GHC.Internal.IO.Exception Methods toException :: AsyncException -> SomeException # fromException :: SomeException -> Maybe AsyncException # displayException :: AsyncException -> String # backtraceDesired :: AsyncException -> Bool # | |
| Exception BlockedIndefinitelyOnMVar | |
Defined in GHC.Internal.IO.Exception Methods toException :: BlockedIndefinitelyOnMVar -> SomeException # fromException :: SomeException -> Maybe BlockedIndefinitelyOnMVar # displayException :: BlockedIndefinitelyOnMVar -> String # backtraceDesired :: BlockedIndefinitelyOnMVar -> Bool # | |
| Exception BlockedIndefinitelyOnSTM | |
Defined in GHC.Internal.IO.Exception Methods toException :: BlockedIndefinitelyOnSTM -> SomeException # fromException :: SomeException -> Maybe BlockedIndefinitelyOnSTM # displayException :: BlockedIndefinitelyOnSTM -> String # backtraceDesired :: BlockedIndefinitelyOnSTM -> Bool # | |
| Exception CompactionFailed | |
Defined in GHC.Internal.IO.Exception Methods toException :: CompactionFailed -> SomeException # fromException :: SomeException -> Maybe CompactionFailed # displayException :: CompactionFailed -> String # backtraceDesired :: CompactionFailed -> Bool # | |
| Exception Deadlock | |
Defined in GHC.Internal.IO.Exception Methods toException :: Deadlock -> SomeException # fromException :: SomeException -> Maybe Deadlock # displayException :: Deadlock -> String # backtraceDesired :: Deadlock -> Bool # | |
| Exception ExitCode | |
Defined in GHC.Internal.IO.Exception Methods toException :: ExitCode -> SomeException # fromException :: SomeException -> Maybe ExitCode # displayException :: ExitCode -> String # backtraceDesired :: ExitCode -> Bool # | |
| Exception FixIOException | |
Defined in GHC.Internal.IO.Exception Methods toException :: FixIOException -> SomeException # fromException :: SomeException -> Maybe FixIOException # displayException :: FixIOException -> String # backtraceDesired :: FixIOException -> Bool # | |
| Exception IOException | |
Defined in GHC.Internal.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # backtraceDesired :: IOException -> Bool # | |
| Exception SomeAsyncException | |
Defined in GHC.Internal.IO.Exception Methods toException :: SomeAsyncException -> SomeException # fromException :: SomeException -> Maybe SomeAsyncException # | |
| Exception ProcessException Source # | |
Defined in RIO.Process Methods toException :: ProcessException -> SomeException # fromException :: SomeException -> Maybe ProcessException # | |
| Exception AsyncExceptionWrapper | |
Defined in Control.Exception.Safe | |
| Exception StringException | |
Defined in Control.Exception.Safe Methods toException :: StringException -> SomeException # fromException :: SomeException -> Maybe StringException # displayException :: StringException -> String # backtraceDesired :: StringException -> Bool # | |
| Exception SyncExceptionWrapper | |
Defined in Control.Exception.Safe | |
| Exception UnicodeException | |
Defined in Data.Text.Encoding.Error Methods toException :: UnicodeException -> SomeException # fromException :: SomeException -> Maybe UnicodeException # | |
| Exception ByteStringOutputException | |
| Exception ExitCodeException | |
Defined in System.Process.Typed.Internal Methods toException :: ExitCodeException -> SomeException # fromException :: SomeException -> Maybe ExitCodeException # | |
| Exception StringException | |
Defined in UnliftIO.Exception Methods toException :: StringException -> SomeException # fromException :: SomeException -> Maybe StringException # displayException :: StringException -> String # backtraceDesired :: StringException -> Bool # | |
| Exception ConcException | |
Defined in UnliftIO.Internals.Async Methods toException :: ConcException -> SomeException # fromException :: SomeException -> Maybe ConcException # displayException :: ConcException -> String # backtraceDesired :: ConcException -> Bool # | |
| Exception a => Exception (ExceptionWithContext a) | |
Defined in GHC.Internal.Exception.Type Methods toException :: ExceptionWithContext a -> SomeException # fromException :: SomeException -> Maybe (ExceptionWithContext a) # displayException :: ExceptionWithContext a -> String # backtraceDesired :: ExceptionWithContext a -> Bool # | |
| Exception e => Exception (NoBacktrace e) | |
Defined in GHC.Internal.Exception.Type Methods toException :: NoBacktrace e -> SomeException # fromException :: SomeException -> Maybe (NoBacktrace e) # displayException :: NoBacktrace e -> String # backtraceDesired :: NoBacktrace e -> Bool # | |
data SomeException #
Constructors
| (Exception e, HasExceptionContext) => SomeException e |
Instances
| Exception SomeException | |
Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException # fromException :: SomeException -> Maybe SomeException # displayException :: SomeException -> String # backtraceDesired :: SomeException -> Bool # | |
| Show SomeException | |
Defined in GHC.Internal.Exception.Type Methods showsPrec :: Int -> SomeException -> ShowS show :: SomeException -> String # showList :: [SomeException] -> ShowS | |
| Display SomeException Source # | Since: 0.1.0.0 |
Defined in RIO.Prelude.Display Methods display :: SomeException -> Utf8Builder Source # textDisplay :: SomeException -> Text Source # | |
data IOException #
Instances
| Exception IOException | |
Defined in GHC.Internal.IO.Exception Methods toException :: IOException -> SomeException # fromException :: SomeException -> Maybe IOException # displayException :: IOException -> String # backtraceDesired :: IOException -> Bool # | |
| Show IOException | |
Defined in GHC.Internal.IO.Exception Methods showsPrec :: Int -> IOException -> ShowS show :: IOException -> String # showList :: [IOException] -> ShowS | |
| Eq IOException | |
Defined in GHC.Internal.IO.Exception | |
| Display IOException Source # | Since: 0.1.0.0 |
Defined in RIO.Prelude.Display | |
| MonadError IOException IO | |
Defined in Control.Monad.Error.Class | |
bracket :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c #
catch :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a #
catchAny :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a #
finally :: MonadUnliftIO m => m a -> m b -> m a #
mask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m b) -> m b #
mask_ :: MonadUnliftIO m => m a -> m a #
onException :: MonadUnliftIO m => m a -> m b -> m a #
uninterruptibleMask :: MonadUnliftIO m => ((forall a. m a -> m a) -> m b) -> m b #
uninterruptibleMask_ :: MonadUnliftIO m => m a -> m a #
data StringException #
Constructors
| StringException String CallStack |
Instances
| Exception StringException | |
Defined in UnliftIO.Exception Methods toException :: StringException -> SomeException # fromException :: SomeException -> Maybe StringException # displayException :: StringException -> String # backtraceDesired :: StringException -> Bool # | |
| Show StringException | |
Defined in UnliftIO.Exception Methods showsPrec :: Int -> StringException -> ShowS show :: StringException -> String # showList :: [StringException] -> ShowS | |
| Eq StringException | |
Defined in UnliftIO.Exception Methods (==) :: StringException -> StringException -> Bool # (/=) :: StringException -> StringException -> Bool # | |
bracketOnError :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c #
bracketOnError_ :: MonadUnliftIO m => m a -> m b -> m c -> m c #
bracket_ :: MonadUnliftIO m => m a -> m b -> m c -> m c #
catchAnyDeep :: (NFData a, MonadUnliftIO m) => m a -> (SomeException -> m a) -> m a #
catchDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> (e -> m a) -> m a #
catchIO :: MonadUnliftIO m => m a -> (IOException -> m a) -> m a #
catchJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> m a -> (b -> m a) -> m a #
catchSyncOrAsync :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a #
catches :: MonadUnliftIO m => m a -> [Handler m a] -> m a #
catchesDeep :: (MonadUnliftIO m, NFData a) => m a -> [Handler m a] -> m a #
evaluateDeep :: (MonadIO m, NFData a) => a -> m a #
fromEither :: (Exception e, MonadIO m) => Either e a -> m a #
fromEitherM :: (Exception e, MonadIO m) => m (Either e a) -> m a #
fromExceptionUnwrap :: Exception e => SomeException -> Maybe e #
handle :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a #
handleAny :: MonadUnliftIO m => (SomeException -> m a) -> m a -> m a #
handleAnyDeep :: (MonadUnliftIO m, NFData a) => (SomeException -> m a) -> m a -> m a #
handleDeep :: (MonadUnliftIO m, Exception e, NFData a) => (e -> m a) -> m a -> m a #
handleIO :: MonadUnliftIO m => (IOException -> m a) -> m a -> m a #
handleJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a #
handleSyncOrAsync :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a #
impureThrow :: Exception e => e -> a #
isAsyncException :: Exception e => e -> Bool #
isSyncException :: Exception e => e -> Bool #
mapExceptionM :: (Exception e1, Exception e2, MonadUnliftIO m) => (e1 -> e2) -> m a -> m a #
pureTry :: a -> Either SomeException a #
pureTryDeep :: NFData a => a -> Either SomeException a #
stringException :: HasCallStack => String -> StringException #
throwString :: (MonadIO m, HasCallStack) => String -> m a #
toAsyncException :: Exception e => e -> SomeException #
toSyncException :: Exception e => e -> SomeException #
try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a) #
tryAny :: MonadUnliftIO m => m a -> m (Either SomeException a) #
tryAnyDeep :: (MonadUnliftIO m, NFData a) => m a -> m (Either SomeException a) #
tryIO :: MonadUnliftIO m => m a -> m (Either IOException a) #
trySyncOrAsync :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a) #
withException :: (MonadUnliftIO m, Exception e) => m a -> (e -> m b) -> m a #
asyncExceptionFromException :: Exception e => SomeException -> Maybe e #
asyncExceptionToException :: Exception e => e -> SomeException #
data SomeAsyncException #
Constructors
| Exception e => SomeAsyncException e |
Instances
| Exception SomeAsyncException | |
Defined in GHC.Internal.IO.Exception Methods toException :: SomeAsyncException -> SomeException # fromException :: SomeException -> Maybe SomeAsyncException # | |
| Show SomeAsyncException | |
Defined in GHC.Internal.IO.Exception Methods showsPrec :: Int -> SomeAsyncException -> ShowS show :: SomeAsyncException -> String # showList :: [SomeAsyncException] -> ShowS | |
data AsyncExceptionWrapper #
Constructors
| Exception e => AsyncExceptionWrapper e |
Instances
| Exception AsyncExceptionWrapper | |
Defined in Control.Exception.Safe | |
| Show AsyncExceptionWrapper | |
Defined in Control.Exception.Safe Methods showsPrec :: Int -> AsyncExceptionWrapper -> ShowS show :: AsyncExceptionWrapper -> String # showList :: [AsyncExceptionWrapper] -> ShowS | |
data SyncExceptionWrapper #
Constructors
| Exception e => SyncExceptionWrapper e |
Instances
| Exception SyncExceptionWrapper | |
Defined in Control.Exception.Safe | |
| Show SyncExceptionWrapper | |
Defined in Control.Exception.Safe Methods showsPrec :: Int -> SyncExceptionWrapper -> ShowS show :: SyncExceptionWrapper -> String # showList :: [SyncExceptionWrapper] -> ShowS | |
Re-exported from Control.Monad.Catch:
throwM :: (MonadThrow m, HasCallStack, Exception e) => e -> m a #
Files and handles
withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a #
Constructors
| ReadMode | |
| WriteMode | |
| AppendMode | |
| ReadWriteMode |
getMonotonicTime :: MonadIO m => m Double #
hGetBuffering :: MonadIO m => Handle -> m BufferMode #
hIsReadable :: MonadIO m => Handle -> m Bool #
hIsSeekable :: MonadIO m => Handle -> m Bool #
hIsTerminalDevice :: MonadIO m => Handle -> m Bool #
hIsWritable :: MonadIO m => Handle -> m Bool #
hSetBuffering :: MonadIO m => Handle -> BufferMode -> m () #
hSetFileSize :: MonadIO m => Handle -> Integer -> m () #
Constructors
| AbsoluteSeek | |
| RelativeSeek | |
| SeekFromEnd |
Instances
| Enum SeekMode | |
| Ix SeekMode | |
Defined in GHC.Internal.IO.Device | |
| Read SeekMode | |
Defined in GHC.Internal.IO.Device | |
| Show SeekMode | |
| Eq SeekMode | |
| Ord SeekMode | |
Defined in GHC.Internal.IO.Device | |
data BufferMode #
Constructors
| NoBuffering | |
| LineBuffering | |
| BlockBuffering (Maybe Int) |
Instances
| Read BufferMode | |
Defined in GHC.Internal.IO.Handle.Types Methods readsPrec :: Int -> ReadS BufferMode readList :: ReadS [BufferMode] readPrec :: ReadPrec BufferMode readListPrec :: ReadPrec [BufferMode] | |
| Show BufferMode | |
Defined in GHC.Internal.IO.Handle.Types Methods showsPrec :: Int -> BufferMode -> ShowS show :: BufferMode -> String # showList :: [BufferMode] -> ShowS | |
| Eq BufferMode | |
Defined in GHC.Internal.IO.Handle.Types | |
| Ord BufferMode | |
Defined in GHC.Internal.IO.Handle.Types Methods compare :: BufferMode -> BufferMode -> Ordering # (<) :: BufferMode -> BufferMode -> Bool # (<=) :: BufferMode -> BufferMode -> Bool # (>) :: BufferMode -> BufferMode -> Bool # (>=) :: BufferMode -> BufferMode -> Bool # max :: BufferMode -> BufferMode -> BufferMode # min :: BufferMode -> BufferMode -> BufferMode # | |
withSystemTempDirectory :: MonadUnliftIO m => String -> (FilePath -> m a) -> m a #
withSystemTempFile :: MonadUnliftIO m => String -> (FilePath -> Handle -> m a) -> m a #
withTempDirectory :: MonadUnliftIO m => FilePath -> String -> (FilePath -> m a) -> m a #
withTempFile :: MonadUnliftIO m => FilePath -> String -> (FilePath -> Handle -> m a) -> m a #
withLazyFile :: MonadUnliftIO m => FilePath -> (ByteString -> m a) -> m a Source #
Lazily get the contents of a file. Unlike readFile, this
ensures that if an exception is thrown, the file handle is closed
immediately.
withLazyFileUtf8 :: MonadUnliftIO m => FilePath -> (Text -> m a) -> m a Source #
Lazily read a file in UTF8 encoding.
Since: 0.1.13
readFileBinary :: MonadIO m => FilePath -> m ByteString Source #
writeFileBinary :: MonadIO m => FilePath -> ByteString -> m () Source #
readFileUtf8 :: MonadIO m => FilePath -> m Text Source #
Read a file in UTF8 encoding, throwing an exception on invalid character encoding.
This function will use OS-specific line ending handling.
writeFileUtf8 :: MonadIO m => FilePath -> Text -> m () Source #
Write a file in UTF8 encoding
This function will use OS-specific line ending handling.
Exit
exitWith :: MonadIO m => ExitCode -> m a Source #
Lifted version of "System.Exit.exitWith".
@since 0.1.9.0.
exitFailure :: MonadIO m => m a Source #
Lifted version of "System.Exit.exitFailure".
@since 0.1.9.0.
exitSuccess :: MonadIO m => m a Source #
Lifted version of "System.Exit.exitSuccess".
@since 0.1.9.0.
Constructors
| ExitSuccess | |
| ExitFailure Int |
Instances
| NFData ExitCode | |||||
Defined in Control.DeepSeq | |||||
| Exception ExitCode | |||||
Defined in GHC.Internal.IO.Exception Methods toException :: ExitCode -> SomeException # fromException :: SomeException -> Maybe ExitCode # displayException :: ExitCode -> String # backtraceDesired :: ExitCode -> Bool # | |||||
| Generic ExitCode | |||||
Defined in GHC.Internal.IO.Exception Associated Types
| |||||
| Read ExitCode | |||||
Defined in GHC.Internal.IO.Exception | |||||
| Show ExitCode | |||||
| Eq ExitCode | |||||
| Ord ExitCode | |||||
Defined in GHC.Internal.IO.Exception | |||||
| type Rep ExitCode | |||||
Defined in GHC.Internal.IO.Exception type Rep ExitCode = D1 ('MetaData "ExitCode" "GHC.Internal.IO.Exception" "ghc-internal" 'False) (C1 ('MetaCons "ExitSuccess" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExitFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) | |||||
Mutable Variables
SomeRef
Abstraction over how to read from and write to a mutable reference
Since: 0.1.4.0
Instances
| HasStateRef a (SomeRef a) Source # | Identity state reference where the SomeRef is the env Since: 0.1.4.0 |
| HasWriteRef a (SomeRef a) Source # | Identity write reference where the SomeRef is the env Since: 0.1.4.0 |
mapRIO :: (outer -> inner) -> RIO inner a -> RIO outer a Source #
Lift one RIO env to another.
Since: 0.1.13.0
class HasStateRef s env | env -> s where Source #
Environment values with stateful capabilities to SomeRef
Since: 0.1.4.0
class HasWriteRef w env | env -> w where Source #
Environment values with writing capabilities to SomeRef
Since: 0.1.4.0
newSomeRef :: MonadIO m => a -> m (SomeRef a) Source #
create a new boxed SomeRef
Since: 0.1.4.0
newUnboxedSomeRef :: (MonadIO m, Unbox a) => a -> m (SomeRef a) Source #
create a new unboxed SomeRef
Since: 0.1.4.0
readSomeRef :: MonadIO m => SomeRef a -> m a Source #
Read from a SomeRef
Since: 0.1.4.0
writeSomeRef :: MonadIO m => SomeRef a -> a -> m () Source #
Write to a SomeRef
Since: 0.1.4.0
modifySomeRef :: MonadIO m => SomeRef a -> (a -> a) -> m () Source #
Modify a SomeRef This function is subject to change due to the lack of atomic operations
Since: 0.1.4.0
URef
An unboxed reference. This works like an IORef, but the data is
stored in a bytearray instead of a heap object, avoiding
significant allocation overhead in some cases. For a concrete
example, see this Stack Overflow question:
https://stackoverflow.com/questions/27261813/why-is-my-little-stref-int-require-allocating-gigabytes.
The first parameter is the state token type, the same as would be
used for the ST monad. If you're using an IO-based monad, you
can use the convenience IOURef type synonym instead.
Since: 0.0.2.0
newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a) Source #
Create a new URef
Since: 0.0.2.0
readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a Source #
Read the value in a URef
Since: 0.0.2.0
writeURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> a -> m () Source #
Write a value into a URef. Note that this action is strict, and
will force evalution of the value.
Since: 0.0.2.0
modifyURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> (a -> a) -> m () Source #
Modify a value in a URef. Note that this action is strict, and
will force evaluation of the result value.
Since: 0.0.2.0
IORef
atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b #
atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b #
atomicWriteIORef :: MonadIO m => IORef a -> a -> m () #
mkWeakIORef :: MonadUnliftIO m => IORef a -> m () -> m (Weak (IORef a)) #
modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m () #
modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m () #
writeIORef :: MonadIO m => IORef a -> a -> m () #
MVar
isEmptyMVar :: MonadIO m => MVar a -> m Bool #
mkWeakMVar :: MonadUnliftIO m => MVar a -> m () -> m (Weak (MVar a)) #
modifyMVar :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b #
modifyMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b #
modifyMVarMasked_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m () #
modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m () #
newEmptyMVar :: MonadIO m => m (MVar a) #
tryPutMVar :: MonadIO m => MVar a -> a -> m Bool #
tryReadMVar :: MonadIO m => MVar a -> m (Maybe a) #
tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a) #
withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b #
withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b #
QSem
signalQSem :: MonadIO m => QSem -> m () #
withQSem :: MonadUnliftIO m => QSem -> m a -> m a #
QSemN
signalQSemN :: MonadIO m => QSemN -> Int -> m () #
withQSemN :: MonadUnliftIO m => QSemN -> Int -> m a -> m a #
Memoize
memoizeMVar :: MonadUnliftIO m => m a -> m (Memoized a) #
memoizeRef :: MonadUnliftIO m => m a -> m (Memoized a) #
runMemoized :: MonadIO m => Memoized a -> m a #
Deque
module RIO.Deque
Debugging
traceM :: Applicative f => Text -> f () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceEvent :: Text -> a -> a Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceEventIO :: MonadIO m => Text -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceMarker :: Text -> a -> a Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceMarkerIO :: MonadIO m => Text -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceStack :: Text -> a -> a Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowId :: Show a => a -> a Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowIO :: (Show a, MonadIO m) => a -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowM :: (Show a, Applicative f) => a -> f () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowEvent :: Show a => a -> b -> b Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowEventIO :: (Show a, MonadIO m) => a -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowMarker :: Show a => a -> b -> b Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowMarkerIO :: (Show a, MonadIO m) => a -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceShowStack :: Show a => a -> b -> b Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplay :: Display a => a -> b -> b Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayId :: Display a => a -> a Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayIO :: (Display a, MonadIO m) => a -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayM :: (Display a, Applicative f) => a -> f () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayEvent :: Display a => a -> b -> b Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayEventIO :: (Display a, MonadIO m) => a -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayMarker :: Display a => a -> b -> b Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayMarkerIO :: (Display a, MonadIO m) => a -> m () Source #
Warning: Trace statement left in code
Since: 0.1.0.0
traceDisplayStack :: Display a => a -> b -> b Source #
Warning: Trace statement left in code
Since: 0.1.0.0