morley-1.18.0: Developer tools for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Util.MultiReader

Description

A poor man's extensible reader effects via nested ReaderT.

Synopsis

Documentation

type family MultiReaderT (xs :: [Type]) (m :: Type -> Type) :: Type -> Type where ... Source #

Convenience type family to build a stack of multiple ReaderT.

Equations

MultiReaderT (x ': xs) m = ReaderT x (MultiReaderT xs m) 
MultiReaderT '[] m = m 

type MonadMultiReaderT m base = (m ~ MultiReaderT (MultiReaderIso m) base, MonadMultiReaderMap (MultiReaderIso m)) Source #

Convenience constraint synonym.

Required for asks`, ask`, local` and mapMultiReaderT

type ChangeMultiReaderBase m newBase = MultiReaderT (MultiReaderIso m) newBase Source #

Replace the base monad for a nested ReaderT stack.

asks' :: forall m r (a :: Type) n. MultiReader n r m => (r -> a) -> m a Source #

Unconstrained version of asks. asks' f = fmap f ask'.

ask' :: MultiReader n r m => m r Source #

Unconstrained version of ask. Lifts the appropriate number of times depending on the type r.

local' :: MultiReader n r m => (r -> r) -> m a -> m a Source #

Unconstrained version of local. Maps the appropriate number of times depending on the type r.

mapMultiReaderT :: (MonadMultiReaderMap xs, m' ~ MultiReaderT xs m, n' ~ MultiReaderT xs n, xs ~ MultiReaderIso m') => (m a -> n b) -> m' a -> n' b Source #

mapReaderT, only it maps over the whole nested ReaderT stack, and not just one level.