Module

Uncurried.ReaderT

Package
purescript-uncurried-transformers
Repository
PureFunctor/purescript-uncurried-transformers

This module defines the reader monad transformer, ReaderT.

#ReaderT Source

newtype ReaderT :: Type -> (Type -> Type) -> Type -> Typenewtype ReaderT r m a

The reader monad transformer, implemented as a newtytpe over RWSET. Note that it's not recommended to stack newtypes of RWSET together as it incurs an indeterminate performance penalty that would otherwise be solved by just using RWSET.

Constructors

Instances

#readerT Source

readerT :: forall r m a. Functor m => (r -> m a) -> ReaderT r m a

Construct a ReaderT given a function that requires some context.

#runReaderT Source

runReaderT :: forall r m a. MonadRec m => r -> ReaderT r m a -> m a

Runs a computation inside of ReaderT.

#hoistReaderT Source

hoistReaderT :: forall r m n a. (m ~> n) -> ReaderT r m a -> ReaderT r n a

Modifies the monadic context of a ReaderT.

#mapReaderT Source

mapReaderT :: forall r m1 m2 a1 a2. MonadRec m1 => Functor m2 => (m1 a1 -> m2 a2) -> ReaderT r m1 a1 -> ReaderT r m2 a2

Modifies the result type of a ReaderT.

#withReaderT Source

withReaderT :: forall r1 r2 m a. (r2 -> r1) -> ReaderT r1 m a -> ReaderT r2 m a

Modifies the environment type of a ReaderT.