Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Util.Logger

Description

A monad like WriterT, but intended for logging.

WriterT is not actually all that good for logging because its (>>=) is not tail recursive.

Synopsis

Documentation

data LoggerT w m a Source #

This uses a plain list for now. DList is not actually very efficient for appends because appending nil doesn't strictly eliminate the nil.

Instances

MonadError e m => MonadError e (LoggerT w m) # 

Methods

throwError :: e -> LoggerT w m a #

catchError :: LoggerT w m a -> (e -> LoggerT w m a) -> LoggerT w m a #

MonadReader r m => MonadReader r (LoggerT w m) # 

Methods

ask :: LoggerT w m r #

local :: (r -> r) -> LoggerT w m a -> LoggerT w m a #

reader :: (r -> a) -> LoggerT w m a #

MonadState s m => MonadState s (LoggerT w m) #

I think I can't automatically derive this because LoggerT itself is a StateT.

Methods

get :: LoggerT w m s #

put :: s -> LoggerT w m () #

state :: (s -> (a, s)) -> LoggerT w m a #

Monad m => MonadLogger w (LoggerT w m) # 

Methods

log :: w -> LoggerT w m () Source #

peek :: LoggerT w m [w] Source #

MonadTrans (LoggerT w) # 

Methods

lift :: Monad m => m a -> LoggerT w m a #

Monad m => Monad (LoggerT w m) # 

Methods

(>>=) :: LoggerT w m a -> (a -> LoggerT w m b) -> LoggerT w m b #

(>>) :: LoggerT w m a -> LoggerT w m b -> LoggerT w m b #

return :: a -> LoggerT w m a #

fail :: String -> LoggerT w m a #

Functor m => Functor (LoggerT w m) # 

Methods

fmap :: (a -> b) -> LoggerT w m a -> LoggerT w m b #

(<$) :: a -> LoggerT w m b -> LoggerT w m a #

Monad m => Applicative.Applicative (LoggerT w m) # 

Methods

pure :: a -> LoggerT w m a #

(<*>) :: LoggerT w m (a -> b) -> LoggerT w m a -> LoggerT w m b #

(*>) :: LoggerT w m a -> LoggerT w m b -> LoggerT w m b #

(<*) :: LoggerT w m a -> LoggerT w m b -> LoggerT w m a #

MonadIO m => MonadIO (LoggerT w m) # 

Methods

liftIO :: IO a -> LoggerT w m a #

type Logger w a = LoggerT w Identity a Source #

run :: Monad m => LoggerT w m a -> m (a, [w]) Source #

run_id :: Logger w a -> (a, [w]) Source #

exec :: Monad m => LoggerT w m a -> m [w] Source #

class Monad m => MonadLogger w m | m -> w where Source #

Minimal complete definition

log, peek

Methods

log :: w -> m () Source #

peek :: m [w] Source #

Instances

(Monoid w, MonadLogger log m) => MonadLogger log (WriterT w m) # 

Methods

log :: log -> WriterT w m () Source #

peek :: WriterT w m [log] Source #

MonadLogger w m => MonadLogger w (ExceptT e m) # 

Methods

log :: w -> ExceptT e m () Source #

peek :: ExceptT e m [w] Source #

(Error e, MonadLogger w m) => MonadLogger w (ErrorT e m) # 

Methods

log :: w -> ErrorT e m () Source #

peek :: ErrorT e m [w] Source #

MonadLogger w m => MonadLogger w (StateT s m) # 

Methods

log :: w -> StateT s m () Source #

peek :: StateT s m [w] Source #

MonadLogger w m => MonadLogger w (StateT s m) # 

Methods

log :: w -> StateT s m () Source #

peek :: StateT s m [w] Source #

Monad m => MonadLogger w (LoggerT w m) # 

Methods

log :: w -> LoggerT w m () Source #

peek :: LoggerT w m [w] Source #

MonadLogger w m => MonadLogger w (ReaderT * r m) # 

Methods

log :: w -> ReaderT * r m () Source #

peek :: ReaderT * r m [w] Source #

logs :: MonadLogger w m => [w] -> m () Source #