cleff-0.2.0.0: Fast and concise extensible effects
Copyright(c) 2021 Xy Ren
LicenseBSD3
Maintainerxy.r@outlook.com
Stabilityexperimental
Portabilitynon-portable (GHC only)
Safe HaskellTrustworthy
LanguageHaskell2010

Cleff.Reader

Description

 
Synopsis

Effect

data Reader r :: Effect where Source #

An effect capable of providing an immutable environment r that can be read. This roughly corresponds to the MonadReader typeclass and ReaderT monad transformer in the mtl approach.

Constructors

Ask :: Reader r m r 
Local :: (r -> r) -> m a -> Reader r m a 

Operations

ask :: Reader r :> es => Eff es r Source #

local :: Reader r :> es => (r -> r) -> Eff es a -> Eff es a Source #

asks :: Reader r :> es => (r -> s) -> Eff es s Source #

Apply a function on the result of ask.

Interpretations

runReader :: r -> Eff (Reader r ': es) ~> Eff es Source #

Run a Reader effect with a given environment value.

magnify :: Reader t :> es => Lens' t r -> Eff (Reader r ': es) ~> Eff es Source #

Run a Reader effect in terms of a larger Reader via a Lens'.