Safe Haskell | None |
---|---|
Language | Haskell2010 |
The multi-valued version of mtl's Writer / WriterT / MonadWriter
- newtype MultiWriterT x m a = MultiWriterT {
- runMultiWriterTRaw :: StateT (HList x) m a
- type MultiWriterTNull = MultiWriterT []
- type MultiWriter x a = MultiWriterT x Identity a
- class (Monad m, Monoid a) => MonadMultiWriter a m where
- mTell :: a -> m ()
- mGetRaw :: Monad m => MultiWriterT a m (HList a)
- withMultiWriter :: Monad m => x -> MultiWriterT (x : xs) m a -> MultiWriterT xs m a
- withMultiWriters :: Monad m => HList xs -> MultiWriterT (Append xs ys) m a -> MultiWriterT ys m a
- runMultiWriterT :: (Monad m, Monoid (HList l)) => MultiWriterT l m a -> m (a, HList l)
- execMultiWriterT :: (Monad m, Monoid (HList l)) => MultiWriterT l m a -> m (HList l)
- mapMultiWriterT :: (m (a, HList w) -> m' (a', HList w)) -> MultiWriterT w m a -> MultiWriterT w m' a'
MultiWriterT
newtype MultiWriterT x m a Source
A Writer transformer monad patameterized by:
- x - The list of types that can be written (Monoid instances).
- m - The inner monad.
MultiWriterT
corresponds to mtl's WriterT
, but can contain
a heterogenous list of types.
This heterogenous list is represented using Types.Data.List, i.e:
'[]
- The empty list,a ': b
- A list wherea
is an arbitrary type andb
is the rest list.
For example,
MultiWriterT '[Int, Bool] :: (* -> *) -> (* -> *)
is a Writer transformer containing the types [Int, Bool].
MultiWriterT | |
|
MonadState s m => MonadState s (MultiWriterT c m) | |
MonadWriter w m => MonadWriter w (MultiWriterT c m) | |
(Monad m, ContainsType a c, Monoid a) => MonadMultiWriter a (MultiWriterT c m) | |
MonadTrans (MultiWriterT x) | |
Monad m => Monad (MultiWriterT x m) | |
Functor f => Functor (MultiWriterT x f) | |
(Applicative m, Monad m) => Applicative (MultiWriterT x m) |
type MultiWriterTNull = MultiWriterT [] Source
A MultiWriter transformer carrying an empty state.
type MultiWriter x a = MultiWriterT x Identity a Source
MonadMultiWriter class
class (Monad m, Monoid a) => MonadMultiWriter a m where Source
(MonadTrans t, Monad (t m), MonadMultiWriter a m) => MonadMultiWriter a (t m) | |
(Monad m, ContainsType a c, Monoid a) => MonadMultiWriter a (MultiWriterT c m) |
functions
mGetRaw :: Monad m => MultiWriterT a m (HList a) Source
withMultiWriter :: Monad m => x -> MultiWriterT (x : xs) m a -> MultiWriterT xs m a Source
withMultiWriters :: Monad m => HList xs -> MultiWriterT (Append xs ys) m a -> MultiWriterT ys m a Source
runMultiWriterT :: (Monad m, Monoid (HList l)) => MultiWriterT l m a -> m (a, HList l) Source
execMultiWriterT :: (Monad m, Monoid (HList l)) => MultiWriterT l m a -> m (HList l) Source
mapMultiWriterT :: (m (a, HList w) -> m' (a', HList w)) -> MultiWriterT w m a -> MultiWriterT w m' a' Source