backend-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.ConsumableStack

Synopsis

Documentation

data ConsumableStackT s (m :: Type -> Type) a Source #

A monad transformer with a pop-only stack that is expected to be fully consumed ("popped").

Instances

Instances details
MonadTrans (ConsumableStackT s) Source # 
Instance details

Defined in Control.Monad.ConsumableStack

Methods

lift :: Monad m => m a -> ConsumableStackT s m a #

Monad m => Applicative (ConsumableStackT s m) Source # 
Instance details

Defined in Control.Monad.ConsumableStack

Methods

pure :: a -> ConsumableStackT s m a #

(<*>) :: ConsumableStackT s m (a -> b) -> ConsumableStackT s m a -> ConsumableStackT s m b #

liftA2 :: (a -> b -> c) -> ConsumableStackT s m a -> ConsumableStackT s m b -> ConsumableStackT s m c #

(*>) :: ConsumableStackT s m a -> ConsumableStackT s m b -> ConsumableStackT s m b #

(<*) :: ConsumableStackT s m a -> ConsumableStackT s m b -> ConsumableStackT s m a #

Functor m => Functor (ConsumableStackT s m) Source # 
Instance details

Defined in Control.Monad.ConsumableStack

Methods

fmap :: (a -> b) -> ConsumableStackT s m a -> ConsumableStackT s m b #

(<$) :: a -> ConsumableStackT s m b -> ConsumableStackT s m a #

Monad m => Monad (ConsumableStackT s m) Source # 
Instance details

Defined in Control.Monad.ConsumableStack

Methods

(>>=) :: ConsumableStackT s m a -> (a -> ConsumableStackT s m b) -> ConsumableStackT s m b #

(>>) :: ConsumableStackT s m a -> ConsumableStackT s m b -> ConsumableStackT s m b #

return :: a -> ConsumableStackT s m a #

pop :: MonadConsumableStack s m => m s Source #

Pop the head off the stack.

runConsumableStackT :: Functor m => ConsumableStackT s m a -> [s] -> m (Either ConsumableStackError a) Source #

Run a consumable stack monad transformer. Returns a ConsumableStackError iff the stack was depleted early or not fully consumed.