ether-0.4.1.0: Monad transformers and classes

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Ether.Writer.Class

Description

Synopsis

Documentation

class (Monoid w, Monad m) => MonadWriter tag w m | m tag -> w where Source #

Methods

writer :: proxy tag -> (a, w) -> m a Source #

Embed a simple writer action.

tell :: proxy tag -> w -> m () Source #

Append a value to the accumulator within the monad.

listen :: proxy tag -> m a -> m (a, w) Source #

Execute an action and add its accumulator to the value of the computation.

pass :: proxy tag -> m (a, w -> w) -> m a Source #

Execute an action which returns a value and a function, and return the value, applying the function to the accumulator.

Instances

(LiftListen t, LiftPass t, Monad (t m), MonadWriter k tag w m, Monoid w) => MonadWriter k tag w (t m) Source # 

Methods

writer :: proxy w -> (a, t m) -> m a Source #

tell :: proxy w -> t m -> m () Source #

listen :: proxy w -> m a -> m (a, t m) Source #

pass :: proxy w -> m (a, t m -> t m) -> m a Source #

(Monoid w, Monad m, (~) * w w') => MonadWriter k tag w (WriterT k tag w' m) Source # 

Methods

writer :: proxy w -> (a, WriterT k tag w' m) -> m a Source #

tell :: proxy w -> WriterT k tag w' m -> m () Source #

listen :: proxy w -> m a -> m (a, WriterT k tag w' m) Source #

pass :: proxy w -> m (a, WriterT k tag w' m -> WriterT k tag w' m) -> m a Source #

listens :: MonadWriter tag w m => proxy tag -> (w -> b) -> m a -> m (a, b) Source #

Execute an action and add the result of applying the given function to its accumulator to the value of the computation.

censor :: MonadWriter tag w m => proxy tag -> (w -> w) -> m a -> m a Source #

Execute an action and apply a function to its accumulator.