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

Control.Effect.Type.Internal.BaseControl

Synopsis

Documentation

newtype BaseControl b m a where Source #

A helper primitive effect that allows for lowering computations to a base monad.

Helper primitive effects are effects that allow you to avoid interpreting one of your own effects as a primitive if the power needed from direct access to the underlying monad can instead be provided by the relevant helper primitive effect. The reason why you'd want to do this is that helper primitive effects already have ThreadsEff instances defined for them; so you don't have to define any for your own effect.

The helper primitive effects offered in this library are -- in order of ascending power -- Regional, Optional, BaseControl and Unlift.

BaseControl is typically 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 a ThreadsEff t (BaseControl b) instance (if possible). threadBaseControlViaClass can help you with that.

The following threading constraints accept BaseControl:

Constructors

GainBaseControl :: (forall z. (MonadBaseControl b z, Coercible z m) => Proxy# z -> a) -> BaseControl b m a 

Instances

Instances details
Carrier m => PrimHandler BaseControlH (BaseControl m) m Source # 
Instance details

Defined in Control.Effect.Internal.BaseControl

ThreadsEff (ExceptT e) (BaseControl b) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

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

Monoid w => ThreadsEff (WriterT w) (BaseControl b) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

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

ThreadsEff (StateT s) (BaseControl b) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

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

ThreadsEff (ReaderT i) (BaseControl b) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

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

ThreadsEff (StateT s) (BaseControl b) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

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

Monoid w => ThreadsEff (WriterT w) (BaseControl b) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

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

Monoid w => ThreadsEff (WriterT w) (BaseControl b) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

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

threadBaseControlViaClass :: forall b t m a. (MonadTrans t, Monad m, forall z. MonadBaseControl b z => MonadBaseControl b (t z), forall z. Coercible z m => Coercible (t z) (t m)) => (forall x. BaseControl b m x -> m x) -> BaseControl b (t m) a -> t m a Source #

A valid definition of threadEff for a ThreadsEff t (BaseControl b) instance, given that t lifts MonadBaseControl b for any b.

threadOptionalViaBaseControl :: forall s t m a. (Functor s, Monad m, Monad (t m), ThreadsEff t (BaseControl m)) => (forall x. Optional s m x -> m x) -> Optional s (t m) a -> t m a Source #

A valid definition of threadEff for a ThreadsEff t (Optional s) instance, given that t threads BaseControl b for any b.

newtype WriterCPS s m a Source #

Constructors

WriterCPS 

Fields

Instances

Instances details
MonadBase b m => MonadBase b (WriterCPS s m) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

liftBase :: b α -> WriterCPS s m α #

(Monoid s, MonadBaseControl b m) => MonadBaseControl b (WriterCPS s m) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Associated Types

type StM (WriterCPS s m) a #

Methods

liftBaseWith :: (RunInBase (WriterCPS s m) b -> b a) -> WriterCPS s m a #

restoreM :: StM (WriterCPS s m) a -> WriterCPS s m a #

MonadTrans (WriterCPS s) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

lift :: Monad m => m a -> WriterCPS s m a #

Monad m => Monad (WriterCPS s m) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

(>>=) :: WriterCPS s m a -> (a -> WriterCPS s m b) -> WriterCPS s m b #

(>>) :: WriterCPS s m a -> WriterCPS s m b -> WriterCPS s m b #

return :: a -> WriterCPS s m a #

Functor m => Functor (WriterCPS s m) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

fmap :: (a -> b) -> WriterCPS s m a -> WriterCPS s m b #

(<$) :: a -> WriterCPS s m b -> WriterCPS s m a #

Monad m => Applicative (WriterCPS s m) Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

Methods

pure :: a -> WriterCPS s m a #

(<*>) :: WriterCPS s m (a -> b) -> WriterCPS s m a -> WriterCPS s m b #

liftA2 :: (a -> b -> c) -> WriterCPS s m a -> WriterCPS s m b -> WriterCPS s m c #

(*>) :: WriterCPS s m a -> WriterCPS s m b -> WriterCPS s m b #

(<*) :: WriterCPS s m a -> WriterCPS s m b -> WriterCPS s m a #

type StM (WriterCPS s m) a Source # 
Instance details

Defined in Control.Effect.Type.Internal.BaseControl

type StM (WriterCPS s m) a = StM m (a, s)