Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Phantom Monad State Transformer constructor and functions.
- newtype PhantomStateT s m a = PhantomStateT (s -> m s)
- type PhantomState s a = PhantomStateT s Identity a
- useState :: Applicative m => (s -> m a) -> PhantomStateT s m ()
- changeState :: Applicative m => (s -> s) -> PhantomStateT s m ()
- runPhantomStateT :: PhantomStateT s m a -> s -> m s
- runPhantomState :: PhantomState s a -> s -> s
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.
PhantomStateT (s -> m s) |
MonadTrans (PhantomStateT s) | |
Monad m => Monad (PhantomStateT s m) | |
Functor (PhantomStateT s m) | |
Monad m => Applicative (PhantomStateT s m) |
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.
:: 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.
:: PhantomState s a | Phantom state computation |
-> s | Initial state |
-> s | Final result |
Specialized version of runPhantomStateT
where the underlying
Monad
is the Identity
monad.