monad-levels-0.1.0.0: Specific levels of monad transformers

Copyright(c) Ivan Lazar Miljenovic
License3-Clause BSD-style
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Levels.Writer.Strict

Description

 

Synopsis

Documentation

writer :: forall w m a. HasWriter w m => (a, w) -> m a Source

Embed a simple writer action.

tell :: HasWriter w m => w -> m () Source

An action that produces the output w.

listen :: forall w m a. CanListen w m a => m a -> m (a, w) Source

Execute the action m and add its output to the value of the computation.

pass :: forall w m a. CanPass w m a => m (a, w -> w) -> m a Source

Execute the action m (which returns a value and a function) and returns the value, applying the function to the output.

newtype WriterT w m a :: * -> (* -> *) -> * -> *

A writer monad parameterized by:

  • w - the output to accumulate.
  • m - The inner monad.

The return function produces the output mempty, while >>= combines the outputs of the subcomputations using mappend.

Constructors

WriterT 

Fields

runWriterT :: m (a, w)
 

Instances

(Monoid w, MonadTower m) => IsWriter w (WriterT w m) 
Monoid w => MonadTrans (WriterT w) 
(Monoid w, Alternative m) => Alternative (WriterT w m) 
(Monoid w, Monad m) => Monad (WriterT w m) 
Functor m => Functor (WriterT w m) 
(Monoid w, MonadFix m) => MonadFix (WriterT w m) 
(Monoid w, MonadPlus m) => MonadPlus (WriterT w m) 
(Monoid w, Applicative m) => Applicative (WriterT w m) 
Foldable f => Foldable (WriterT w f) 
Traversable f => Traversable (WriterT w f) 
(Eq w, Eq1 m) => Eq1 (WriterT w m) 
(Ord w, Ord1 m) => Ord1 (WriterT w m) 
(Read w, Read1 m) => Read1 (WriterT w m) 
(Show w, Show1 m) => Show1 (WriterT w m) 
(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
(Monoid w, MonadTower m) => MonadLevel_ (WriterT w m) 
(Monoid w, MonadTower m) => MonadTower_ (WriterT w m) 
(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) 
(Ord w, Ord1 m, Ord a) => Ord (WriterT w m a) 
(Read w, Read1 m, Read a) => Read (WriterT w m a) 
(Show w, Show1 m, Show a) => Show (WriterT w m a) 
type LowerMonad (WriterT w m) = m 
type WithLower_ (WriterT w m) = AddIG 
type AllowOtherValues (WriterT w m) = True 
type DefaultAllowConstraints (WriterT w m) = True 
type BaseMonad (WriterT w m) = BaseMonad m 
type InnerValue (WriterT w m) a = (a, w) 

class (Monoid w, MonadTower m) => IsWriter w m Source

The minimal definition needed for a monad providing a writer environment.

Instances

(Monoid w, MonadTower m) => IsWriter w (WriterT w m) 
(Monoid w, MonadTower m) => IsWriter w (WriterT w m) 
(Monoid w, MonadTower m) => IsWriter w (RWST r w s m) 
(Monoid w, MonadTower m) => IsWriter w (RWST r w s m) 
Monoid w => ValidConstraint (IsWriter w) 
type ConstraintSatisfied (IsWriter w) m