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

Control.Effect.Carrier.Internal.Stepped

Synopsis

Documentation

data FOEff e x where Source #

Constructors

FOEff :: e q x -> FOEff e x 

class (forall m n x. Coercible (e m x) (e n x)) => FirstOrder (e :: Effect) Source #

A constraint that e is first-order.

This is automatically deduced by the compiler.

Instances

Instances details
(forall (m :: Type -> Type) (n :: Type -> Type) x. Coercible (e m x) (e n x)) => FirstOrder e Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

newtype SteppedC (e :: Effect) m a Source #

A carrier for any first-order effect e that allows for dividing a computation into several steps, where each step is seperated by the use of the effect.

This can be used to implement coroutines.

Constructors

SteppedC 

Fields

Instances

Instances details
(Monoid w, Carrier m, Threaders '[SteppedThreads] m p) => PrimHandler ListenSteppedH (ListenPrim w) (SteppedC (Tell w) m) Source # 
Instance details

Defined in Control.Effect.Internal.Intercept

(FirstOrder e, Carrier m, Threaders '[SteppedThreads] m p) => PrimHandler InterceptH (Unravel (InterceptB e)) (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Intercept

MonadBase b m => MonadBase b (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

liftBase :: b α -> SteppedC e m α #

MonadTrans (SteppedC e) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

lift :: Monad m => m a -> SteppedC e m a #

Monad (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

(>>=) :: SteppedC e m a -> (a -> SteppedC e m b) -> SteppedC e m b #

(>>) :: SteppedC e m a -> SteppedC e m b -> SteppedC e m b #

return :: a -> SteppedC e m a #

Functor (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

fmap :: (a -> b) -> SteppedC e m a -> SteppedC e m b #

(<$) :: a -> SteppedC e m b -> SteppedC e m a #

MonadFail m => MonadFail (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

fail :: String -> SteppedC e m a #

Applicative (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

pure :: a -> SteppedC e m a #

(<*>) :: SteppedC e m (a -> b) -> SteppedC e m a -> SteppedC e m b #

liftA2 :: (a -> b -> c) -> SteppedC e m a -> SteppedC e m b -> SteppedC e m c #

(*>) :: SteppedC e m a -> SteppedC e m b -> SteppedC e m b #

(<*) :: SteppedC e m a -> SteppedC e m b -> SteppedC e m a #

MonadIO m => MonadIO (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

liftIO :: IO a -> SteppedC e m a #

MonadThrow m => MonadThrow (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

throwM :: Exception e0 => e0 -> SteppedC e m a #

MonadCatch m => MonadCatch (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

catch :: Exception e0 => SteppedC e m a -> (e0 -> SteppedC e m a) -> SteppedC e m a #

(Threads (FreeT (FOEff e)) (Prims m), Carrier m) => Carrier (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Associated Types

type Derivs (SteppedC e m) :: [Effect] Source #

type Prims (SteppedC e m) :: [Effect] Source #

type Derivs (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

type Derivs (SteppedC e m) = e ': Derivs m
type Prims (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

type Prims (SteppedC e m) = Prims m

sendStepped :: e q a -> SteppedC e m a Source #

data Steps (e :: Effect) m a where Source #

A stack of continuations of m that eventually produces a result of type a. Each continuation is seperated by the use of the effect e.

Constructors

Done :: a -> Steps e m a 
More :: e q x -> (x -> m (Steps e m a)) -> Steps e m a 

Instances

Instances details
Functor m => Monad (Steps e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

(>>=) :: Steps e m a -> (a -> Steps e m b) -> Steps e m b #

(>>) :: Steps e m a -> Steps e m b -> Steps e m b #

return :: a -> Steps e m a #

Functor m => Functor (Steps e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

fmap :: (a -> b) -> Steps e m a -> Steps e m b #

(<$) :: a -> Steps e m b -> Steps e m a #

Functor m => Applicative (Steps e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

pure :: a -> Steps e m a #

(<*>) :: Steps e m (a -> b) -> Steps e m a -> Steps e m b #

liftA2 :: (a -> b -> c) -> Steps e m a -> Steps e m b -> Steps e m c #

(*>) :: Steps e m a -> Steps e m b -> Steps e m b #

(<*) :: Steps e m a -> Steps e m b -> Steps e m a #

steps :: forall e m a p. (Carrier m, Threaders '[SteppedThreads] m p) => SteppedC e m a -> m (Steps e m a) Source #

Run the first-order effect e by breaking the computation using it into steps, where each step is seperated by the use of an action of e.

Derivs (SteppedC e m) = e ': Derivs m
Prims  (SteppedC e m) = Prims m

liftSteps :: (MonadTrans t, Monad m) => Steps e m a -> Steps e (t m) a Source #

unsteps :: forall e m a. (FirstOrder e, Member e (Derivs m), Carrier m) => Steps e m a -> m a Source #

Execute all the steps of a computation.

type SteppedThreads = FreeThreads Source #

SteppedThreads accepts the following primitive effects: