phantom-state-0.1.0.0: Phantom State Monad Transformer. Like State Monad, but without values.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.PhantomState

Description

Phantom Monad State Transformer constructor and functions.

Synopsis

Documentation

newtype PhantomStateT s m a Source

The Phantom State Monad Transformer is like the State Monad Transformer, but it does not hold any value.

Constructors

PhantomStateT (s -> m s) 

type PhantomState s a = PhantomStateT s Identity a Source

Type synonym of PhantomStateT where the underlying Monad is the Identity monad.

useState :: Applicative m => (s -> m a) -> PhantomStateT s m () Source

Perform an applicative action using the current state, leaving the state unchanged.

changeState :: Applicative m => (s -> s) -> PhantomStateT s m () Source

Modify the state using a pure function.

runPhantomStateT Source

Arguments

:: PhantomStateT s m a

Phantom state computation

-> s

Initial state

-> m s

Final result

Perform a phantom state computation by setting an initial state and running all the actions from there.

runPhantomState Source

Arguments

:: PhantomState s a

Phantom state computation

-> s

Initial state

-> s

Final result

Specialized version of runPhantomStateT where the underlying Monad is the Identity monad.