in-other-words-0.2.0.0: A higher-order effect system where the sky's the limit
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Type.ReaderPrim

Synopsis

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 ThreadsEff t (ReaderPrim i) instance (if possible). threadReaderPrimViaClass and threadReaderPrimViaRegional can help you with that.

The following threading constraints accept ReaderPrim:

Constructors

ReaderPrimAsk :: ReaderPrim i m i 
ReaderPrimLocal :: (i -> i) -> m a -> ReaderPrim i m a 

Instances

Instances details
ThreadsEff ListT (ReaderPrim i) Source # 
Instance details

Defined in Control.Monad.Trans.List.Church

Methods

threadEff :: Monad m => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (ListT m) a -> ListT m a Source #

(Reifies s (ReifiedEffAlgebra (ReaderPrim i) m), Monad m) => MonadReader i (ViaAlg s (ReaderPrim i) m) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

ask :: ViaAlg s (ReaderPrim i) m i #

local :: (i -> i) -> ViaAlg s (ReaderPrim i) m a -> ViaAlg s (ReaderPrim i) m a #

reader :: (i -> a) -> ViaAlg s (ReaderPrim i) m a #

ThreadsEff (ExceptT e) (ReaderPrim threadedInput) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

threadEff :: Monad m => (forall x. ReaderPrim threadedInput m x -> m x) -> ReaderPrim threadedInput (ExceptT e m) a -> ExceptT e m a Source #

Monoid w => ThreadsEff (WriterT w) (ReaderPrim threadedInput) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

threadEff :: Monad m => (forall x. ReaderPrim threadedInput m x -> m x) -> ReaderPrim threadedInput (WriterT w m) a -> WriterT w m a Source #

ThreadsEff (StateT s) (ReaderPrim threadedInput) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

threadEff :: Monad m => (forall x. ReaderPrim threadedInput m x -> m x) -> ReaderPrim threadedInput (StateT s m) a -> StateT s m a Source #

ThreadsEff (ReaderT i') (ReaderPrim i) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

threadEff :: Monad m => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (ReaderT i' m) a -> ReaderT i' m a Source #

ThreadsEff (StateT s) (ReaderPrim threadedInput) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

threadEff :: Monad m => (forall x. ReaderPrim threadedInput m x -> m x) -> ReaderPrim threadedInput (StateT s m) a -> StateT s m a Source #

Monoid w => ThreadsEff (WriterT w) (ReaderPrim threadedInput) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

threadEff :: Monad m => (forall x. ReaderPrim threadedInput m x -> m x) -> ReaderPrim threadedInput (WriterT w m) a -> WriterT w m a Source #

Monoid w => ThreadsEff (WriterT w) (ReaderPrim i) Source # 
Instance details

Defined in Control.Effect.Type.ReaderPrim

Methods

threadEff :: Monad m => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (WriterT w m) a -> WriterT w m a Source #

ThreadsEff (FreeT f) (ReaderPrim i) Source # 
Instance details

Defined in Control.Monad.Trans.Free.Church.Alternate

Methods

threadEff :: Monad m => (forall x. ReaderPrim i m x -> m x) -> ReaderPrim i (FreeT f m) a -> FreeT f m a Source #

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 ThreadsEff t (ReaderPrim w) instance only by specifying how 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 ThreadsEff t (ReaderPrim i) instance, given that 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 ThreadsEff t (ReaderPrim i) instance, given that t threads Regional s for any s.