monadology-0.1
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Ology.Specific.WriterT

Synopsis

Documentation

execWriter :: Writer w a -> w #

Extract the output from a writer computation.

execWriterT :: Monad m => WriterT w m a -> m w #

Extract the output from a writer computation.

mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' b #

Map both the return value and output of a computation using the given function.

mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b #

Map both the return value and output of a computation using the given function.

runWriter :: Writer w a -> (a, w) #

Unwrap a writer computation as a (result, output) pair. (The inverse of writer.)

type Writer w = WriterT w Identity #

A writer monad parameterized by the type w of output to accumulate.

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

newtype WriterT w (m :: Type -> Type) 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

Instances

Instances details
Monoid w => TransConstraint MonadFail (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadFail m => Dict (MonadFail (WriterT w m)) Source #

Monoid w => TransConstraint MonadFix (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadFix m => Dict (MonadFix (WriterT w m)) Source #

Monoid w => TransConstraint MonadIO (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadIO m => Dict (MonadIO (WriterT w m)) Source #

Monoid w => TransConstraint Applicative (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). Applicative m => Dict (Applicative (WriterT w m)) Source #

Monoid w => TransConstraint Functor (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). Functor m => Dict (Functor (WriterT w m)) Source #

Monoid w => TransConstraint Monad (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). Monad m => Dict (Monad (WriterT w m)) Source #

Monoid w => TransConstraint MonadPlus (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadPlus m => Dict (MonadPlus (WriterT w m)) Source #

Monoid w => TransConstraint MonadException (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadException m => Dict (MonadException (WriterT w m)) Source #

Monoid w => TransConstraint MonadExtract (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadExtract m => Dict (MonadExtract (WriterT w m)) Source #

Monoid w => TransConstraint MonadInner (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadInner m => Dict (MonadInner (WriterT w m)) Source #

(MonadCatch e m, Monoid w) => MonadCatch e (WriterT w m) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

catch :: WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a Source #

(MonadThrow e m, Monoid w) => MonadThrow e (WriterT w m) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

throw :: e -> WriterT w m a Source #

Monoid w => MonadTransCoerce (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

transCoerce :: forall (m1 :: Type -> Type) (m2 :: Type -> Type). Coercible m1 m2 => Dict (Coercible (WriterT w m1) (WriterT w m2)) Source #

Monoid w => MonadTransHoist (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hoist :: forall (m1 :: Type -> Type) (m2 :: Type -> Type). (Monad m1, Monad m2) => (m1 --> m2) -> WriterT w m1 --> WriterT w m2 Source #

Monoid w => MonadTransTunnel (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Associated Types

type Tunnel (WriterT w) :: Type -> Type Source #

Methods

tunnel :: Monad m => ((forall (m1 :: Type -> Type) a. Monad m1 => WriterT w m1 a -> m1 (Tunnel (WriterT w) a)) -> m (Tunnel (WriterT w) r)) -> WriterT w m r Source #

Monoid w => MonadTransUnlift (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Monoid w => MonadTrans (WriterT w) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

lift :: Monad m => m a -> WriterT w m a #

Monoid w => TransConstraint (MonadCatch e) (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadCatch e m => Dict (MonadCatch e (WriterT w m)) Source #

Monoid w => TransConstraint (MonadThrow e) (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadThrow e m => Dict (MonadThrow e (WriterT w m)) Source #

(Monoid w, MonadFail m) => MonadFail (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

fail :: String -> WriterT w m a #

(Monoid w, MonadFix m) => MonadFix (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

mfix :: (a -> WriterT w m a) -> WriterT w m a #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftIO :: IO a -> WriterT w m a #

(Monoid w, MonadZip m) => MonadZip (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

mzip :: WriterT w m a -> WriterT w m b -> WriterT w m (a, b) #

mzipWith :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c #

munzip :: WriterT w m (a, b) -> (WriterT w m a, WriterT w m b) #

Foldable f => Foldable (WriterT w f) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

fold :: Monoid m => WriterT w f m -> m #

foldMap :: Monoid m => (a -> m) -> WriterT w f a -> m #

foldMap' :: Monoid m => (a -> m) -> WriterT w f a -> m #

foldr :: (a -> b -> b) -> b -> WriterT w f a -> b #

foldr' :: (a -> b -> b) -> b -> WriterT w f a -> b #

foldl :: (b -> a -> b) -> b -> WriterT w f a -> b #

foldl' :: (b -> a -> b) -> b -> WriterT w f a -> b #

foldr1 :: (a -> a -> a) -> WriterT w f a -> a #

foldl1 :: (a -> a -> a) -> WriterT w f a -> a #

toList :: WriterT w f a -> [a] #

null :: WriterT w f a -> Bool #

length :: WriterT w f a -> Int #

elem :: Eq a => a -> WriterT w f a -> Bool #

maximum :: Ord a => WriterT w f a -> a #

minimum :: Ord a => WriterT w f a -> a #

sum :: Num a => WriterT w f a -> a #

product :: Num a => WriterT w f a -> a #

(Eq w, Eq1 m) => Eq1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftEq :: (a -> b -> Bool) -> WriterT w m a -> WriterT w m b -> Bool #

(Ord w, Ord1 m) => Ord1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftCompare :: (a -> b -> Ordering) -> WriterT w m a -> WriterT w m b -> Ordering #

(Read w, Read1 m) => Read1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (WriterT w m a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [WriterT w m a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (WriterT w m a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [WriterT w m a] #

(Show w, Show1 m) => Show1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> WriterT w m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [WriterT w m a] -> ShowS #

Contravariant m => Contravariant (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

contramap :: (a' -> a) -> WriterT w m a -> WriterT w m a' #

(>$) :: b -> WriterT w m b -> WriterT w m a #

Traversable f => Traversable (WriterT w f) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

traverse :: Applicative f0 => (a -> f0 b) -> WriterT w f a -> f0 (WriterT w f b) #

sequenceA :: Applicative f0 => WriterT w f (f0 a) -> f0 (WriterT w f a) #

mapM :: Monad m => (a -> m b) -> WriterT w f a -> m (WriterT w f b) #

sequence :: Monad m => WriterT w f (m a) -> m (WriterT w f a) #

(Monoid w, Alternative m) => Alternative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

empty :: WriterT w m a #

(<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

some :: WriterT w m a -> WriterT w m [a] #

many :: WriterT w m a -> WriterT w m [a] #

(Monoid w, Applicative m) => Applicative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

pure :: a -> WriterT w m a #

(<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b #

liftA2 :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c #

(*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b #

(<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a #

Functor m => Functor (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

fmap :: (a -> b) -> WriterT w m a -> WriterT w m b #

(<$) :: a -> WriterT w m b -> WriterT w m a #

(Monoid w, Monad m) => Monad (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

(>>=) :: WriterT w m a -> (a -> WriterT w m b) -> WriterT w m b #

(>>) :: WriterT w m a -> WriterT w m b -> WriterT w m b #

return :: a -> WriterT w m a #

(Monoid w, MonadPlus m) => MonadPlus (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

mzero :: WriterT w m a #

mplus :: WriterT w m a -> WriterT w m a -> WriterT w m a #

Invariant m => Invariant (WriterT w m)

from the transformers package

Instance details

Defined in Data.Functor.Invariant

Methods

invmap :: (a -> b) -> (b -> a) -> WriterT w m a -> WriterT w m b #

(Monoid w, MonadException m) => MonadException (WriterT w m) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Associated Types

type Exc (WriterT w m) Source #

Methods

throwExc :: Exc (WriterT w m) -> WriterT w m a Source #

catchExc :: WriterT w m a -> (Exc (WriterT w m) -> WriterT w m a) -> WriterT w m a Source #

(MonadExtract m, Monoid w) => MonadExtract (WriterT w m) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

mToValue :: Extract (WriterT w m) Source #

(MonadInner m, Monoid w) => MonadInner (WriterT w m) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

Methods

retrieveInner :: WriterT w m a -> Result (Exc (WriterT w m)) a Source #

(Read w, Read1 m, Read a) => Read (WriterT w m a) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

readsPrec :: Int -> ReadS (WriterT w m a) #

readList :: ReadS [WriterT w m a] #

readPrec :: ReadPrec (WriterT w m a) #

readListPrec :: ReadPrec [WriterT w m a] #

(Show w, Show1 m, Show a) => Show (WriterT w m a) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

showsPrec :: Int -> WriterT w m a -> ShowS #

show :: WriterT w m a -> String #

showList :: [WriterT w m a] -> ShowS #

(Eq w, Eq1 m, Eq a) => Eq (WriterT w m a) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

(==) :: WriterT w m a -> WriterT w m a -> Bool #

(/=) :: WriterT w m a -> WriterT w m a -> Bool #

(Ord w, Ord1 m, Ord a) => Ord (WriterT w m a) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

compare :: WriterT w m a -> WriterT w m a -> Ordering #

(<) :: WriterT w m a -> WriterT w m a -> Bool #

(<=) :: WriterT w m a -> WriterT w m a -> Bool #

(>) :: WriterT w m a -> WriterT w m a -> Bool #

(>=) :: WriterT w m a -> WriterT w m a -> Bool #

max :: WriterT w m a -> WriterT w m a -> WriterT w m a #

min :: WriterT w m a -> WriterT w m a -> WriterT w m a #

type Tunnel (WriterT w) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

type Tunnel (WriterT w) = (,) w
type Exc (WriterT w m) Source # 
Instance details

Defined in Control.Monad.Ology.Specific.WriterT

type Exc (WriterT w m) = Exc m

writer :: forall (m :: Type -> Type) a w. Monad m => (a, w) -> WriterT w m a #

Construct a writer computation from a (result, output) pair. (The inverse of runWriter.)

tell :: forall (m :: Type -> Type) w. Monad m => w -> WriterT w m () #

tell w is an action that produces the output w.

pass :: forall (m :: Type -> Type) w a. Monad m => WriterT w m (a, w -> w) -> WriterT w m a #

pass m is an action that executes the action m, which returns a value and a function, and returns the value, applying the function to the output.

listens :: forall (m :: Type -> Type) w b a. Monad m => (w -> b) -> WriterT w m a -> WriterT w m (a, b) #

listens f m is an action that executes the action m and adds the result of applying f to the output to the value of the computation.

listen :: forall (m :: Type -> Type) w a. Monad m => WriterT w m a -> WriterT w m (a, w) #

listen m is an action that executes the action m and adds its output to the value of the computation.

censor :: forall (m :: Type -> Type) w a. Monad m => (w -> w) -> WriterT w m a -> WriterT w m a #

censor f m is an action that executes the action m and applies the function f to its output, leaving the return value unchanged.

Orphan instances

Monoid w => TransConstraint MonadFail (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadFail m => Dict (MonadFail (WriterT w m)) Source #

Monoid w => TransConstraint MonadFix (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadFix m => Dict (MonadFix (WriterT w m)) Source #

Monoid w => TransConstraint MonadIO (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadIO m => Dict (MonadIO (WriterT w m)) Source #

Monoid w => TransConstraint Applicative (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). Applicative m => Dict (Applicative (WriterT w m)) Source #

Monoid w => TransConstraint Functor (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). Functor m => Dict (Functor (WriterT w m)) Source #

Monoid w => TransConstraint Monad (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). Monad m => Dict (Monad (WriterT w m)) Source #

Monoid w => TransConstraint MonadPlus (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadPlus m => Dict (MonadPlus (WriterT w m)) Source #

Monoid w => TransConstraint MonadException (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadException m => Dict (MonadException (WriterT w m)) Source #

Monoid w => TransConstraint MonadExtract (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadExtract m => Dict (MonadExtract (WriterT w m)) Source #

Monoid w => TransConstraint MonadInner (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadInner m => Dict (MonadInner (WriterT w m)) Source #

(MonadCatch e m, Monoid w) => MonadCatch e (WriterT w m) Source # 
Instance details

Methods

catch :: WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a Source #

(MonadThrow e m, Monoid w) => MonadThrow e (WriterT w m) Source # 
Instance details

Methods

throw :: e -> WriterT w m a Source #

Monoid w => MonadTransCoerce (WriterT w) Source # 
Instance details

Methods

transCoerce :: forall (m1 :: Type -> Type) (m2 :: Type -> Type). Coercible m1 m2 => Dict (Coercible (WriterT w m1) (WriterT w m2)) Source #

Monoid w => MonadTransHoist (WriterT w) Source # 
Instance details

Methods

hoist :: forall (m1 :: Type -> Type) (m2 :: Type -> Type). (Monad m1, Monad m2) => (m1 --> m2) -> WriterT w m1 --> WriterT w m2 Source #

Monoid w => MonadTransTunnel (WriterT w) Source # 
Instance details

Associated Types

type Tunnel (WriterT w) :: Type -> Type Source #

Methods

tunnel :: Monad m => ((forall (m1 :: Type -> Type) a. Monad m1 => WriterT w m1 a -> m1 (Tunnel (WriterT w) a)) -> m (Tunnel (WriterT w) r)) -> WriterT w m r Source #

Monoid w => MonadTransUnlift (WriterT w) Source # 
Instance details

Monoid w => TransConstraint (MonadCatch e) (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadCatch e m => Dict (MonadCatch e (WriterT w m)) Source #

Monoid w => TransConstraint (MonadThrow e) (WriterT w) Source # 
Instance details

Methods

hasTransConstraint :: forall (m :: Type -> Type). MonadThrow e m => Dict (MonadThrow e (WriterT w m)) Source #

(Monoid w, MonadException m) => MonadException (WriterT w m) Source # 
Instance details

Associated Types

type Exc (WriterT w m) Source #

Methods

throwExc :: Exc (WriterT w m) -> WriterT w m a Source #

catchExc :: WriterT w m a -> (Exc (WriterT w m) -> WriterT w m a) -> WriterT w m a Source #

(MonadExtract m, Monoid w) => MonadExtract (WriterT w m) Source # 
Instance details

Methods

mToValue :: Extract (WriterT w m) Source #

(MonadInner m, Monoid w) => MonadInner (WriterT w m) Source # 
Instance details

Methods

retrieveInner :: WriterT w m a -> Result (Exc (WriterT w m)) a Source #