Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
The multi-valued version of mtl's Writer / WriterT
- 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
- runMultiWriterT :: (Monoid (HList w), Functor m) => MultiWriterT w m a -> m (a, HList w)
- runMultiWriterTAW :: (Monoid (HList w), Functor m) => MultiWriterT w m a -> m (a, HList w)
- runMultiWriterTWA :: (Monoid (HList w), Monad m) => MultiWriterT w m a -> m (HList w, a)
- runMultiWriterTW :: (Monoid (HList w), Monad m) => MultiWriterT w m a -> m (HList w)
- runMultiWriterTNil :: Monad m => MultiWriterT '[] m a -> m a
- runMultiWriterTNil_ :: Functor m => MultiWriterT '[] m a -> m ()
- withMultiWriter :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m (a, w)
- withMultiWriterAW :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m (a, w)
- withMultiWriterWA :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m (w, a)
- withMultiWriterW :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m w
- withMultiWriters :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (a, HList w1)
- withMultiWritersAW :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (a, HList w1)
- withMultiWritersWA :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (HList w1, a)
- withMultiWritersW :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (HList w1)
- inflateWriter :: (Monad m, Monoid w, ContainsType w ws) => WriterT w m a -> MultiWriterT ws m a
- mapMultiWriterT :: (m (a, HList w) -> m' (a', HList w)) -> MultiWriterT w m a -> MultiWriterT w m' a'
- mGetRaw :: Monad m => MultiWriterT a m (HList a)
- mPutRaw :: Monad m => HList s -> MultiWriterT s m ()
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 | |
|
MonadBase b m => MonadBase b (MultiWriterT c m) Source # | |
MonadBaseControl b m => MonadBaseControl b (MultiWriterT c m) Source # | |
MonadState s m => MonadState s (MultiWriterT c m) Source # | |
MonadWriter w m => MonadWriter w (MultiWriterT c m) Source # | |
(Monad m, ContainsType a c, Monoid a) => MonadMultiWriter a (MultiWriterT c m) Source # | |
MonadTrans (MultiWriterT x) Source # | |
MonadTransControl (MultiWriterT c) Source # | |
Monad m => Monad (MultiWriterT x m) Source # | |
Functor f => Functor (MultiWriterT x f) Source # | |
MonadFix m => MonadFix (MultiWriterT w m) Source # | |
(Applicative m, Monad m) => Applicative (MultiWriterT x m) Source # | |
MonadIO m => MonadIO (MultiWriterT c m) Source # | |
(Functor m, Applicative m, MonadPlus m) => Alternative (MultiWriterT c m) Source # | |
MonadPlus m => MonadPlus (MultiWriterT c m) Source # | |
type StT (MultiWriterT c) a Source # | |
type StM (MultiWriterT c m) a Source # | |
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) Source # | |
(Monad m, ContainsType a c, Monoid a) => MonadMultiWriter a (MultiWriterT c m) Source # | |
(Monad m, ContainsType a c, Monoid a) => MonadMultiWriter a (MultiWriterT c m) Source # | |
(Monad m, Monoid a, HListMContains TellableFlag a cts) => MonadMultiWriter a (MultiGSTT cts m) Source # | |
(Monad m, Monoid a, HListMContains TellableFlag a cts) => MonadMultiWriter a (MultiGSTT cts m) Source # | |
(Monad m, ContainsType a w, Monoid a) => MonadMultiWriter a (MultiRWST r w s m) Source # | |
(Monad m, ContainsType a w, Monoid a) => MonadMultiWriter a (MultiRWST r w s m) Source # | |
run-functions
runMultiWriterT :: (Monoid (HList w), Functor m) => MultiWriterT w m a -> m (a, HList w) Source #
runMultiWriterTAW :: (Monoid (HList w), Functor m) => MultiWriterT w m a -> m (a, HList w) Source #
runMultiWriterTWA :: (Monoid (HList w), Monad m) => MultiWriterT w m a -> m (HList w, a) Source #
runMultiWriterTW :: (Monoid (HList w), Monad m) => MultiWriterT w m a -> m (HList w) Source #
runMultiWriterTNil :: Monad m => MultiWriterT '[] m a -> m a Source #
runMultiWriterTNil_ :: Functor m => MultiWriterT '[] m a -> m () Source #
with-functions (single Writer)
withMultiWriter :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m (a, w) Source #
withMultiWriterAW :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m (a, w) Source #
withMultiWriterWA :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m (w, a) Source #
withMultiWriterW :: (Monoid w, Monad m) => MultiWriterT (w ': ws) m a -> MultiWriterT ws m w Source #
with-functions (multiple Writers)
withMultiWriters :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (a, HList w1) Source #
withMultiWritersAW :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (a, HList w1) Source #
withMultiWritersWA :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (HList w1, a) Source #
withMultiWritersW :: forall w1 w2 m a. (Monoid (HList w1), Monad m, HInit w1) => MultiWriterT (Append w1 w2) m a -> MultiWriterT w2 m (HList w1) Source #
inflate-function (run WriterT in MultiWriterT)
inflateWriter :: (Monad m, Monoid w, ContainsType w ws) => WriterT w m a -> MultiWriterT ws m a Source #
other functions
mapMultiWriterT :: (m (a, HList w) -> m' (a', HList w)) -> MultiWriterT w m a -> MultiWriterT w m' a' Source #
Map both the return value and the state of a computation using the given function.