Copyright | (c) Michael Szvetits 2020 |
---|---|
License | BSD3 (see the file LICENSE) |
Maintainer | typedbyte@qualified.name |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Strict interpretations of the Writer'
effect.
If you don't require disambiguation of multiple writer effects (i.e., you only have one writer effect in your monadic context), you usually need the untagged interpretations.
Synopsis
- data WriterT w m a
- execWriter' :: forall tag w m a. (Monad m, Monoid w) => (Writer' tag w `Via` WriterT w) m a -> m w
- runWriter' :: forall tag w m a. (Functor m, Monoid w) => (Writer' tag w `Via` WriterT w) m a -> m (w, a)
- execWriter :: (Monad m, Monoid w) => (Writer w `Via` WriterT w) m a -> m w
- runWriter :: (Functor m, Monoid w) => (Writer w `Via` WriterT w) m a -> m (w, a)
Interpreter Type
The strict interpreter of the writer effect. This type implements the
Writer'
type class in a strict manner.
When interpreting the effect, you usually don't interact with this type directly, but instead use one of its corresponding interpretation functions.
Instances
(Monad m, Monoid w) => Writer' (tag :: k) w (WriterT w m) Source # | |
MonadBase b m => MonadBase b (WriterT w m) Source # | |
Defined in Control.Effect.Writer.Strict | |
(MonadBaseControl b m, Monoid w) => MonadBaseControl b (WriterT w m) Source # | |
MonadTrans (WriterT w) Source # | |
Defined in Control.Effect.Writer.Strict | |
Monoid w => MonadTransControl (WriterT w) Source # | |
Monad m => Monad (WriterT w m) Source # | |
Functor m => Functor (WriterT w m) Source # | |
Monad m => Applicative (WriterT w m) Source # | |
Defined in Control.Effect.Writer.Strict | |
MonadIO m => MonadIO (WriterT w m) Source # | |
Defined in Control.Effect.Writer.Strict | |
type StT (WriterT w) a Source # | |
Defined in Control.Effect.Writer.Strict | |
type StM (WriterT w m) a Source # | |
Defined in Control.Effect.Writer.Strict |
Tagged Interpretations
:: forall tag w m a. (Monad m, Monoid w) | |
=> (Writer' tag w `Via` WriterT w) m a | The program whose writer effect should be handled. |
-> m w | The program with its writer effect handled, producing the final output |
Runs the writer effect and returns the final output.
:: forall tag w m a. (Functor m, Monoid w) | |
=> (Writer' tag w `Via` WriterT w) m a | The program whose writer effect should be handled. |
-> m (w, a) | The program with its writer effect handled, producing the final output |
Runs the writer effect and returns both the final output and the result of the interpreted program.
Untagged Interpretations
execWriter :: (Monad m, Monoid w) => (Writer w `Via` WriterT w) m a -> m w Source #
The untagged version of execWriter'
.