Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Ask i :: Effect where
- data Local i :: Effect where
- type Reader i = Bundle [Local i, Ask i]
- ask :: Eff (Ask i) m => m i
- asks :: Eff (Ask i) m => (i -> a) -> m a
- local :: Eff (Local i) m => (i -> i) -> m a -> m a
- runAskConst :: forall i m a. Carrier m => i -> InterpretReifiedC (Ask i) m a -> m a
- runAskAction :: forall i m a. Carrier m => m i -> InterpretReifiedC (Ask i) m a -> m a
- askToAsk :: forall i j m a. Eff (Ask j) m => (j -> i) -> InterpretReifiedC (Ask i) m a -> m a
- runReader :: forall i m a p. (Carrier m, Threaders '[ReaderThreads] m p) => i -> ReaderC i m a -> m a
- runAskConstSimple :: forall i m a p. (Carrier m, Threaders '[ReaderThreads] m p) => i -> InterpretSimpleC (Ask i) m a -> m a
- runAskActionSimple :: forall i m a p. (Carrier m, Threaders '[ReaderThreads] m p) => m i -> InterpretSimpleC (Ask i) m a -> m a
- askToAskSimple :: forall i j m a p. (Eff (Ask j) m, Threaders '[ReaderThreads] m p) => (j -> i) -> InterpretSimpleC (Ask i) m a -> m a
- class (forall i. Threads (ReaderT i) p) => ReaderThreads p
- data ReaderC i m a
Effects
data Local i :: Effect where Source #
An effect for locally modifying an environment used to gain access to information.
Actions
Interpretations
runAskConst :: forall i m a. Carrier m => i -> InterpretReifiedC (Ask i) m a -> m a Source #
Run an Ask
effect by providing a constant to be given
at each use of ask
.
This has a higher-rank type, as it makes use of InterpretReifiedC
.
This makes runAskConst
very difficult to use partially applied.
In particular, it can't be composed using
..
If performance is secondary, consider using the slower runAskConstSimple
,
which doesn't have a higher-rank type.
runAskAction :: forall i m a. Carrier m => m i -> InterpretReifiedC (Ask i) m a -> m a Source #
Run an Ask
effect by providing an action to be executed
at each use of ask
.
This has a higher-rank type, as it makes use of InterpretReifiedC
.
This makes runAskAction
very difficult to use partially applied.
In particular, it can't be composed using
..
If performance is secondary, consider using the slower runAskActionSimple
,
which doesn't have a higher-rank type.
askToAsk :: forall i j m a. Eff (Ask j) m => (j -> i) -> InterpretReifiedC (Ask i) m a -> m a Source #
Transform an
effect into an Ask
i
effect by
providing a function to convert Ask
jj
to i
.
This has a higher-rank type, as it makes use of InterpretReifiedC
.
This makes askToAsk
very difficult to use partially applied.
In particular, it can't be composed using
..
If performance is secondary, consider using the slower askToAskSimple
,
which doesn't have a higher-rank type.
runReader :: forall i m a p. (Carrier m, Threaders '[ReaderThreads] m p) => i -> ReaderC i m a -> m a Source #
Simple variants
runAskConstSimple :: forall i m a p. (Carrier m, Threaders '[ReaderThreads] m p) => i -> InterpretSimpleC (Ask i) m a -> m a Source #
Run an Ask
effect by providing a constant to be given
at each use of ask
This is a less performant version of runAskConst
that doesn't have
a higher-rank type, making it much easier to use partially applied.
runAskActionSimple :: forall i m a p. (Carrier m, Threaders '[ReaderThreads] m p) => m i -> InterpretSimpleC (Ask i) m a -> m a Source #
Run an Ask
effect by providing an action to be executed
at each use of ask
.
This is a less performant version of runAskAction
that doesn't have
a higher-rank type, making it much easier to use partially applied.
askToAskSimple :: forall i j m a p. (Eff (Ask j) m, Threaders '[ReaderThreads] m p) => (j -> i) -> InterpretSimpleC (Ask i) m a -> m a Source #
Threading constraints
class (forall i. Threads (ReaderT i) p) => ReaderThreads p Source #
The most common threading constraint of the library, as it is emitted by
-Simple
interpreters (interpreters that internally make use of
interpretSimple
or reinterpretSimple
).
ReaderThreads
accepts all the primitive effects
(intended to be used as such) offered in this library.
Most notably, ReaderThreads
accepts
.Unlift
b
Instances
(forall i. Threads (ReaderT i) p) => ReaderThreads p Source # | |
Defined in Control.Effect.Internal.Union |