Safe Haskell | None |
---|
A pure implementation of MonadLog using MonadWriter
Synopsis
- type LogSeq = Seq (Priority, String)
- type WriterSeq = WriterT LogSeq
- newtype WriterLogT m a = WriterLogT {
- unwrapWriterLogT :: WriterSeq m a
- type WriterLog = WriterLogT Identity
- runWriterLogT :: WriterLogT m a -> m (a, LogSeq)
- runWriterLog :: WriterLog a -> (a, LogSeq)
- execWriterLogT :: MonadLog m => WriterLogT m a -> m a
- dumpLogSeq :: MonadLog m => LogSeq -> m ()
- execWriterLog :: MonadLog m => WriterLog a -> m a
The data type of the monad transformer
newtype WriterLogT m a Source #
A monad transformer that adds pure logging capability.
WriterLogT | |
|
Instances
MonadTrans WriterLogT # | |
Defined in Ganeti.Logging.WriterLog lift :: Monad m => m a -> WriterLogT m a | |
MonadTransControl WriterLogT # | |
Defined in Ganeti.Logging.WriterLog type StT WriterLogT a liftWith :: Monad m => (Run WriterLogT -> m a) -> WriterLogT m a restoreT :: Monad m => m (StT WriterLogT a) -> WriterLogT m a | |
MonadBase IO m => MonadBase IO (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog liftBase :: IO α -> WriterLogT m α | |
MonadBaseControl IO m => MonadBaseControl IO (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog type StM (WriterLogT m) a liftBaseWith :: (RunInBase (WriterLogT m) IO -> IO a) -> WriterLogT m a restoreM :: StM (WriterLogT m) a -> WriterLogT m a | |
Monad m => Monad (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog (>>=) :: WriterLogT m a -> (a -> WriterLogT m b) -> WriterLogT m b (>>) :: WriterLogT m a -> WriterLogT m b -> WriterLogT m b return :: a -> WriterLogT m a | |
Functor m => Functor (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog fmap :: (a -> b) -> WriterLogT m a -> WriterLogT m b (<$) :: a -> WriterLogT m b -> WriterLogT m a | |
Applicative m => Applicative (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog pure :: a -> WriterLogT m a (<*>) :: WriterLogT m (a -> b) -> WriterLogT m a -> WriterLogT m b liftA2 :: (a -> b -> c) -> WriterLogT m a -> WriterLogT m b -> WriterLogT m c (*>) :: WriterLogT m a -> WriterLogT m b -> WriterLogT m b (<*) :: WriterLogT m a -> WriterLogT m b -> WriterLogT m a | |
Alternative m => Alternative (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog empty :: WriterLogT m a (<|>) :: WriterLogT m a -> WriterLogT m a -> WriterLogT m a some :: WriterLogT m a -> WriterLogT m [a] many :: WriterLogT m a -> WriterLogT m [a] | |
MonadPlus m => MonadPlus (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog mzero :: WriterLogT m a mplus :: WriterLogT m a -> WriterLogT m a -> WriterLogT m a | |
MonadIO m => MonadIO (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog liftIO :: IO a -> WriterLogT m a | |
Monad m => MonadLog (WriterLogT m) # | |
Defined in Ganeti.Logging.WriterLog logAt :: Priority -> String -> WriterLogT m () Source # | |
type StT WriterLogT a # | |
Defined in Ganeti.Logging.WriterLog type StT WriterLogT a | |
type StM (WriterLogT m) a # | |
Defined in Ganeti.Logging.WriterLog |
type WriterLog = WriterLogT Identity Source #
runWriterLogT :: WriterLogT m a -> m (a, LogSeq) Source #
runWriterLog :: WriterLog a -> (a, LogSeq) Source #
execWriterLogT :: MonadLog m => WriterLogT m a -> m a Source #
Runs a WriterLogT
, and when it finishes, resends all log messages
to the underlying monad that implements MonadLog
.
This can be used to delay logging messages, by accumulating them
in WriterLogT
, and resending them at the end to the underlying monad.