Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The dynamically dispatched variant of the Reader
effect.
Note: unless you plan to change interpretations at runtime, it's recommended to use the statically dispatched variant, i.e. Effectful.Reader.Static.
Synopsis
- data Reader r :: Effect where
- runReader :: r -> Eff (Reader r ': es) a -> Eff es a
- withReader :: (r1 -> r2) -> Eff (Reader r2 ': es) a -> Eff (Reader r1 ': es) a
- ask :: (HasCallStack, Reader r :> es) => Eff es r
- asks :: (HasCallStack, Reader r :> es) => (r -> a) -> Eff es a
- local :: (HasCallStack, Reader r :> es) => (r -> r) -> Eff es a -> Eff es a
Effect
data Reader r :: Effect where Source #
Instances
type DispatchOf (Reader r) Source # | |
Defined in Effectful.Reader.Dynamic |
Handlers
Run the Reader
effect with the given initial environment (via
Effectful.Reader.Static).
:: (r1 -> r2) | The function to modify the environment. |
-> Eff (Reader r2 ': es) a | Computation to run in the modified environment. |
-> Eff (Reader r1 ': es) a |
Execute a computation in a modified environment.
Since: 1.1.0.0
Operations
:: (HasCallStack, Reader r :> es) | |
=> (r -> a) | The function to apply to the environment. |
-> Eff es a |