Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ReaderPrim i :: Effect where
- ReaderPrimAsk :: ReaderPrim i m i
- ReaderPrimLocal :: (i -> i) -> m a -> ReaderPrim i m a
- threadReaderPrim :: forall i t m a. (MonadTrans t, Monad m) => ((forall x. ReaderPrim i m x -> m x) -> (i -> i) -> t m a -> t m a) -> (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (t m) a -> t m a
- threadReaderPrimViaClass :: forall i t m a. Monad m => (RepresentationalT t, MonadTrans t, forall b. MonadReader i b => MonadReader i (t b)) => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (t m) a -> t m a
- threadReaderPrimViaRegional :: forall i t m a. (Monad m, MonadTrans t, ThreadsEff t (Regional ())) => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (t m) a -> t m a
Effects
data ReaderPrim i :: Effect where Source #
A primitive effect that may be used for
interpreters of connected Ask
and
Local
effects.
This combines Ask
and Local
,
which is relevant since certain monad transformers may only lift
local
if they also have access to
ask
.
ReaderPrim
is only used as a primitive effect.
If you define a Carrier
that relies on a novel
non-trivial monad transformer t
, then you need to make
a
instance (if possible).
ThreadsEff
t (ReaderPrim
i)threadReaderPrimViaClass
and threadReaderPrimViaRegional
can help you with that.
The following threading constraints accept ReaderPrim
:
ReaderPrimAsk :: ReaderPrim i m i | |
ReaderPrimLocal :: (i -> i) -> m a -> ReaderPrim i m a |
Instances
Threading utilities
threadReaderPrim :: forall i t m a. (MonadTrans t, Monad m) => ((forall x. ReaderPrim i m x -> m x) -> (i -> i) -> t m a -> t m a) -> (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (t m) a -> t m a Source #
Construct a valid definition of threadEff
for a
instance
only by specifying how ThreadsEff
t (ReaderPrim
w)ReaderPrimLocal
should be lifted.
This uses lift
to lift ReaderPrimAsk
.
threadReaderPrimViaClass :: forall i t m a. Monad m => (RepresentationalT t, MonadTrans t, forall b. MonadReader i b => MonadReader i (t b)) => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (t m) a -> t m a Source #
A valid definition of threadEff
for a
instance, given that ThreadsEff
t (ReaderPrim
i)t
lifts
.MonadReader
i
threadReaderPrimViaRegional :: forall i t m a. (Monad m, MonadTrans t, ThreadsEff t (Regional ())) => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (t m) a -> t m a Source #
A valid definition of threadEff
for a
instance, given that ThreadsEff
t (ReaderPrim
i)t
threads
for any Regional
ss
.