| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Effects.Reader
Description
The regular old MonadReader effect with some differences. First, there's no functional
dependency limiting your stack to a single environment type. This means less type inference so
it might not be enough to just write readEnv. Write 'readEnv @MyEnvType' instead using
TypeApplications.
Second, the function has a less generic name and is called readEnv.
Third, since it's a part of this effect framework, you get a implementReadEnv function with
which you can provide a different environment implementation _at runtime_.
- data ReadEnv e
- readEnv :: forall e m. MonadEffect (ReadEnv e) m => m e
- implementReadEnv :: Functor m => m e -> RuntimeImplemented (ReadEnv e) m a -> m a
- module Control.Effects
Documentation
readEnv :: forall e m. MonadEffect (ReadEnv e) m => m e Source #
Read a value of type e. Use with the TypeApplications extension to
help with type inference
readEnv @Int
implementReadEnv :: Functor m => m e -> RuntimeImplemented (ReadEnv e) m a -> m a Source #
Use the given action in the underlying monad to provide environment
values. You can think of implementReadEnv x m as replacing all readEnv calls
in m with x.
module Control.Effects