Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class (Monad m, Monoid w) => MonadWriter w m | m -> w where
- mute :: MonadWriter w m => m a -> m a
- intercept :: MonadWriter w m => m a -> m (w, a)
- intercept' :: MonadWriter w m => m a -> m w
- eavesdrop :: MonadWriter w m => m a -> m w
- data WriterT w m a
- type Writer w a = WriterT w Id a
- writerT :: (Functor m, Functor m') => Iso (WriterT w m a) (WriterT w' m' b) (m (w, a)) (m' (w', b))
- writer :: Iso (Writer w a) (Writer w' b) (w, a) (w', b)
- pureWriter :: Monoid w => Iso (w, a) (w', b) a b
- class (SubSemi acc w, MonadWriter w m) => MonadCounter w acc m | m -> acc where
- data CounterT w acc m a
- type Counter w acc a = CounterT w acc Id a
- i'counterT :: (SubSemi acc w, Monoid acc', Functor m) => Iso (CounterT w acc m a) (CounterT w' acc' m' a') (m (a, acc, w)) (m' (a', acc', w'))
- i'counter :: (SubSemi acc w, Monoid acc') => Iso (Counter w acc a) (Counter w' acc' a') (a, acc, w) (a', acc', w')
The Writer monad
class (Monad m, Monoid w) => MonadWriter w m | m -> w where Source #
MonadWriter w m => MonadWriter w (Free m) Source # | |
MonadWriter w m => MonadWriter w (ListT m) Source # | |
MonadWriter w m => MonadWriter w (TreeT m) Source # | |
MonadWriter w m => MonadWriter w (MaybeT m) Source # | |
MonadWriter w m => MonadWriter w (StrictT m) Source # | |
MonadWriter w m => MonadWriter w (LogicT m) Source # | |
(Traversable f, Monad f, MonadWriter w g) => MonadWriter w (Compose' f g) Source # | |
MonadWriter w m => MonadWriter w (ReaderT r m) Source # | |
MonadWriter w m => MonadWriter w (StateT s m) Source # | |
(Monoid w, Monad m) => MonadWriter w (WriterT w m) Source # | |
(Monad m, SubSemi acc w, Monoid w) => MonadWriter w (CounterT w acc m) Source # | |
(Monad m, Monoid w) => MonadWriter w (RWST r w s m) Source # | |
Ring t => MonadWriter (Product t) (ProbT t m) Source # | |
mute :: MonadWriter w m => m a -> m a Source #
intercept :: MonadWriter w m => m a -> m (w, a) Source #
intercept' :: MonadWriter w m => m a -> m w Source #
eavesdrop :: MonadWriter w m => m a -> m w Source #
The Writer transformer
A simple Writer monad
writerT :: (Functor m, Functor m') => Iso (WriterT w m a) (WriterT w' m' b) (m (w, a)) (m' (w', b)) Source #
pureWriter :: Monoid w => Iso (w, a) (w', b) a b Source #
Keeping track of where we are
class (SubSemi acc w, MonadWriter w m) => MonadCounter w acc m | m -> acc where Source #
getCounter :: m acc Source #
setCounter :: acc -> m () Source #
MonadCounter w a m => MonadCounter w a (Free m) Source # | |
MonadCounter w acc m => MonadCounter w acc (ReaderT r m) Source # | |
MonadCounter w acc m => MonadCounter w acc (StateT s m) Source # | |
(Monad m, Monoid w, SubSemi acc w) => MonadCounter w acc (CounterT w acc m) Source # | |
Implementation
data CounterT w acc m a Source #
The canonical representsation of a WriterAcc Monad
(Monad m, Monoid w, SubSemi acc w) => MonadCounter w acc (CounterT w acc m) Source # | |
(Monad m, Monoid w, MonadFuture n m) => MonadFuture n (CounterT w acc m) Source # | |
(Monad m, SubSemi acc w, Monoid w) => MonadWriter w (CounterT w acc m) Source # | |
(MonadState s m, Monoid w) => MonadState s (CounterT w acc m) Source # | |
Monoid w => ConcreteMonad (CounterT w acc) Source # | |
Monoid w => MonadTrans (CounterT w acc) Source # | |
(Monoid w, Unit m) => Unit (CounterT w acc m) Source # | |
(MonadFix m, Monoid w) => MonadFix (CounterT w acc m) Source # | |
(Monoid w, Monad m) => Monad (CounterT w a m) Source # | |
(Monad m, Monoid w) => Applicative (CounterT w acc m) Source # | |
(Monad m, Monoid w) => SemiApplicative (CounterT w acc m) Source # | |
Functor m => Functor (CounterT w acc m) Source # | |
i'counterT :: (SubSemi acc w, Monoid acc', Functor m) => Iso (CounterT w acc m a) (CounterT w' acc' m' a') (m (a, acc, w)) (m' (a', acc', w')) Source #
i'counter :: (SubSemi acc w, Monoid acc') => Iso (Counter w acc a) (Counter w' acc' a') (a, acc, w) (a', acc', w') Source #
Orphan instances
Monoid w => MonadWriter w ((,) w) Source # | |