| Copyright | (c) Samuel Schlesinger 2020 |
|---|---|
| License | MIT |
| Maintainer | sgschlesinger@gmail.com |
| Stability | experimental |
| Portability | POSIX, Windows |
| Safe Haskell | None |
| Language | Haskell2010 |
Control.Monad.Trans.Stack
Description
Synopsis
- newtype Stack (ts :: [(* -> *) -> * -> *]) (m :: * -> *) a = Stack {}
- type family Stack' (ts :: [(* -> *) -> * -> *]) (m :: * -> *) :: * -> * where ...
- type family Substack n ts f where ...
- data N
- class (n :: N) > (m :: N)
- class Uplift n ts f where
- liftSubstack :: Substack n ts f a -> Stack ts f a
- type family IndexIn t ts where ...
- uplift :: forall t ts f a. Uplift (IndexIn t ts) ts f => Substack (IndexIn t ts) ts f a -> Stack ts f a
- newtype Runner ts = Runner (forall f a. Monad f => Stack ts f a -> f a)
- class WithRunner ts where
- class Representable t where
- run :: Monad f => Runner ts -> Stack ts f a -> f a
Documentation
newtype Stack (ts :: [(* -> *) -> * -> *]) (m :: * -> *) a Source #
A computation consisting of a stack of monad transformers and a base monad.
Instances
| (forall (f' :: Type -> Type). Monad f' => Monad (t f'), MonadTrans t, forall (f' :: Type -> Type). Monad f' => Monad (Stack ts f'), MonadTrans (Stack ts)) => MonadTrans (Stack (t ': ts)) Source # | |
Defined in Control.Monad.Trans.Stack | |
| MonadTrans (Stack ([] :: [(Type -> Type) -> Type -> Type])) Source # | |
Defined in Control.Monad.Trans.Stack | |
| (forall (f' :: Type -> Type). Monad f' => Monad (t f'), MonadTrans t, Monad f, Monad (Stack ts f)) => Monad (Stack (t ': ts) f) Source # | |
| Monad f => Monad (Stack ([] :: [(Type -> Type) -> Type -> Type]) f) Source # | |
| (forall (f' :: Type -> Type). Monad f' => Monad (t f'), Monad f, Monad (Stack ts f)) => Functor (Stack (t ': ts) f) Source # | |
| Functor f => Functor (Stack ([] :: [(Type -> Type) -> Type -> Type]) f) Source # | |
| (forall (f' :: Type -> Type). Monad f' => Monad (t f'), Monad f, Monad (Stack ts f)) => Applicative (Stack (t ': ts) f) Source # | |
Defined in Control.Monad.Trans.Stack Methods pure :: a -> Stack (t ': ts) f a # (<*>) :: Stack (t ': ts) f (a -> b) -> Stack (t ': ts) f a -> Stack (t ': ts) f b # liftA2 :: (a -> b -> c) -> Stack (t ': ts) f a -> Stack (t ': ts) f b -> Stack (t ': ts) f c # (*>) :: Stack (t ': ts) f a -> Stack (t ': ts) f b -> Stack (t ': ts) f b # (<*) :: Stack (t ': ts) f a -> Stack (t ': ts) f b -> Stack (t ': ts) f a # | |
| Applicative f => Applicative (Stack ([] :: [(Type -> Type) -> Type -> Type]) f) Source # | |
Defined in Control.Monad.Trans.Stack | |
type family Stack' (ts :: [(* -> *) -> * -> *]) (m :: * -> *) :: * -> * where ... Source #
The type family which we interleave with Stack for its implementation.
type family Substack n ts f where ... Source #
Computes a substack, or a suffix, of the given stack of monad transformers.
class Uplift n ts f where Source #
A type family used to lift substacks up into the full Stack
computation.
Methods
liftSubstack :: Substack n ts f a -> Stack ts f a Source #
Instances
| Uplift Z (t ': ts) f Source # | |
Defined in Control.Monad.Trans.Stack | |
| (MonadTrans t, MonadTrans (Stack (t ': ts)), Monad (Stack ts f), Uplift n ts f) => Uplift (S n) (t ': ts) f Source # | |
Defined in Control.Monad.Trans.Stack | |
uplift :: forall t ts f a. Uplift (IndexIn t ts) ts f => Substack (IndexIn t ts) ts f a -> Stack ts f a Source #
A Runner for a stack of transformers in an arbitrary monad.
class WithRunner ts where Source #
Laws: (runner >>= phi -> run phi (x >>= f)) == (runner >>= phi -> run phi x >>= run phi f)
Minimal complete definition
Nothing
Methods
runner :: (Monad f, Monad (Stack ts f)) => Stack ts f (Runner ts) Source #
withRunner :: (Monad f, Monad (Stack ts f)) => (Runner ts -> Stack ts f a) -> Stack ts f a Source #
Instances
| WithRunner ([] :: [(Type -> Type) -> Type -> Type]) Source # | |
| (Representable t, WithRunner ts, forall (f :: Type -> Type). Monad f => Monad (t f), forall (f :: Type -> Type). Monad f => Monad (Stack ts f), MonadTrans t) => WithRunner (t ': ts) Source # | |
class Representable t where Source #
The class of Representable transformers. Basically, these can be
constant size containers or functions, or arbitrary combination of the two.