mtsl-0.1.0.0: Reified monad transformer stacks

Copyright(c) Samuel Schlesinger 2020
LicenseMIT
Maintainersgschlesinger@gmail.com
Stabilityexperimental
PortabilityPOSIX, Windows
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Trans.Stack

Description

 
Synopsis

Documentation

newtype Stack (ts :: [(* -> *) -> * -> *]) (m :: * -> *) a Source #

A computation consisting of a stack of monad transformers and a base monad.

Constructors

Stack 

Fields

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 # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

lift :: Monad m => m a -> Stack (t ': ts) m a #

MonadTrans (Stack ([] :: [(Type -> Type) -> Type -> Type])) Source # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

lift :: Monad m => m a -> Stack [] m a #

(forall (f' :: Type -> Type). Monad f' => Monad (t f'), MonadTrans t, Monad f, Monad (Stack ts f)) => Monad (Stack (t ': ts) f) Source # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

(>>=) :: Stack (t ': ts) f a -> (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 b #

return :: a -> Stack (t ': ts) f a #

fail :: String -> Stack (t ': ts) f a #

Monad f => Monad (Stack ([] :: [(Type -> Type) -> Type -> Type]) f) Source # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

(>>=) :: Stack [] f a -> (a -> Stack [] f b) -> Stack [] f b #

(>>) :: Stack [] f a -> Stack [] f b -> Stack [] f b #

return :: a -> Stack [] f a #

fail :: String -> Stack [] f a #

(forall (f' :: Type -> Type). Monad f' => Monad (t f'), Monad f, Monad (Stack ts f)) => Functor (Stack (t ': ts) f) Source # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

fmap :: (a -> b) -> Stack (t ': ts) f a -> Stack (t ': ts) f b #

(<$) :: a -> Stack (t ': ts) f b -> Stack (t ': ts) f a #

Functor f => Functor (Stack ([] :: [(Type -> Type) -> Type -> Type]) f) Source # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

fmap :: (a -> b) -> Stack [] f a -> Stack [] f b #

(<$) :: a -> Stack [] f b -> Stack [] f a #

(forall (f' :: Type -> Type). Monad f' => Monad (t f'), Monad f, Monad (Stack ts f)) => Applicative (Stack (t ': ts) f) Source # 
Instance details

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 # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

pure :: a -> Stack [] f a #

(<*>) :: Stack [] f (a -> b) -> Stack [] f a -> Stack [] f b #

liftA2 :: (a -> b -> c) -> Stack [] f a -> Stack [] f b -> Stack [] f c #

(*>) :: Stack [] f a -> Stack [] f b -> Stack [] f b #

(<*) :: Stack [] f a -> Stack [] f b -> Stack [] f a #

type family Stack' (ts :: [(* -> *) -> * -> *]) (m :: * -> *) :: * -> * where ... Source #

The type family which we interleave with Stack for its implementation.

Equations

Stack' (t ': ts) m = t (Stack ts m) 
Stack' '[] m = m 

type family Substack n ts f where ... Source #

Computes a substack, or a suffix, of the given stack of monad transformers.

Equations

Substack Z (t ': ts) f = t (Stack ts f) 
Substack (S n) (t ': ts) f = Substack n ts f 

data N Source #

Type level natural numbers.

Constructors

S N 
Z 

class (n :: N) > (m :: N) Source #

Greater than constraint.

Instances
n > m => (S n) > m Source # 
Instance details

Defined in Control.Monad.Trans.Stack

(S n) > Z Source # 
Instance details

Defined in Control.Monad.Trans.Stack

class Uplift n ts f where Source #

A type family used to lift substacks up into the full Stack computation.

Methods

uplift :: Substack n ts f a -> Stack ts f a Source #

Instances
Uplift Z (t ': ts) f Source # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

uplift :: Substack Z (t ': ts) f a -> Stack (t ': ts) f a Source #

(MonadTrans t, MonadTrans (Stack (t ': ts)), Monad (Stack ts f), Uplift n ts f) => Uplift (S n) (t ': ts) f Source # 
Instance details

Defined in Control.Monad.Trans.Stack

Methods

uplift :: Substack (S n) (t ': ts) f a -> Stack (t ': ts) f a Source #

type family IndexIn t ts where ... Source #

Computes the index of an item in a type level list.

Equations

IndexIn t (t ': ts) = Z 
IndexIn t (t' ': ts) = S (IndexIn t ts) 
IndexIn t ts = TypeError (((Text "Could not find " :<>: ShowType t) :<>: Text " in list ") :<>: ShowType ts) 

liftSubstack :: forall t ts f a. Uplift (IndexIn t ts) ts f => Substack (IndexIn t ts) ts f a -> Stack ts f a Source #

Lifts a substack, or a suffix, of the Stack all the way up into the Stack computation. Expected to be used with TypeApplications.