extensible-skeleton-0.0.1: Operational-based extensible effect library
Copyright(c) Fumiaki Kinoshita 2018
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Extensible.Effect

Description

Name-based extensible effects

Synopsis

Base

data Instruction (xs :: [Assoc k (Type -> Type)]) a where Source #

A unit of named effects. This is a variant of (:|) specialised for 'Type -> Type'.

Constructors

Instruction :: !(Membership xs kv) -> TargetOf kv a -> Instruction xs a 

Instances

Instances details
(Monoid w, Lookup xs "Writer" ((,) w)) => MonadWriter w (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

writer :: (a, w) -> Eff xs a #

tell :: w -> Eff xs () #

listen :: Eff xs a -> Eff xs (a, w) #

pass :: Eff xs (a, w -> w) -> Eff xs a #

Lookup xs "State" (State s) => MonadState s (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

get :: Eff xs s #

put :: s -> Eff xs () #

state :: (s -> (a, s)) -> Eff xs a #

Lookup xs "Reader" ((:~:) r) => MonadReader r (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

ask :: Eff xs r #

local :: (r -> r) -> Eff xs a -> Eff xs a #

reader :: (r -> a) -> Eff xs a #

Lookup xs "Either" (Const e :: Type -> Type) => MonadError e (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

throwError :: e -> Eff xs a #

catchError :: Eff xs a -> (e -> Eff xs a) -> Eff xs a #

(Monoid e, Lookup xs "Either" (Const e :: Type -> Type)) => Alternative (Eff xs) Source #

A bit dubious

Instance details

Defined in Data.Extensible.Effect.Default

Methods

empty :: Eff xs a #

(<|>) :: Eff xs a -> Eff xs a -> Eff xs a #

some :: Eff xs a -> Eff xs [a] #

many :: Eff xs a -> Eff xs [a] #

(Monoid e, Lookup xs "Either" (Const e :: Type -> Type)) => MonadPlus (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

mzero :: Eff xs a #

mplus :: Eff xs a -> Eff xs a -> Eff xs a #

(MonadIO m, Lookup xs "IO" m) => MonadIO (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

liftIO :: IO a -> Eff xs a #

(MonadThrow m, Lookup xs "IO" m) => MonadThrow (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

throwM :: Exception e => e -> Eff xs a #

(MonadCatch m, Lookup xs "IO" m) => MonadCatch (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

catch :: Exception e => Eff xs a -> (e -> Eff xs a) -> Eff xs a #

MonadCont (Eff (ContDef r (Eff xs) ': xs)) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

callCC :: ((a -> Eff (ContDef r (Eff xs) ': xs) b) -> Eff (ContDef r (Eff xs) ': xs) a) -> Eff (ContDef r (Eff xs) ': xs) a #

(MonadResource m, Lookup xs "IO" m) => MonadResource (Eff xs) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

liftResourceT :: ResourceT IO a -> Eff xs a #

type Eff xs = Skeleton (Instruction xs) Source #

The extensible operational monad

liftEff :: forall s t xs a. Lookup xs s t => Proxy s -> t a -> Eff xs a Source #

Lift an instruction onto an Eff action.

liftsEff :: forall s t xs a r. Lookup xs s t => Proxy s -> t a -> (a -> r) -> Eff xs r Source #

Lift an instruction onto an Eff action and apply a function to the result.

hoistEff :: forall s t xs a. Lookup xs s t => Proxy s -> (forall x. t x -> t x) -> Eff xs a -> Eff xs a Source #

Censor a specific type of effects in an action.

castEff :: IncludeAssoc ys xs => Eff xs a -> Eff ys a Source #

Upcast an action.

Step-wise handling

newtype Interpreter f g Source #

Transformation between effects

Constructors

Interpreter 

Fields

handleEff :: RecordOf (Interpreter m) xs -> Eff xs a -> MonadView m (Eff xs) a Source #

Process an Eff action using a record of Interpreters.

Peeling

peelEff Source #

Arguments

:: forall k t xs a r. Rebinder xs r

Re-bind an unrelated action

-> (a -> r)

return the result

-> (forall x. t x -> (x -> r) -> r)

Handle the foremost type of an action

-> Eff ((k >: t) ': xs) a 
-> r 

Build a relay-style handler from a triple of functions.

runStateEff = peelEff1 (a s -> return (a, s))
  (m k s -> let (a, s') = runState m s in k a s')

type Rebinder xs r = forall x. Instruction xs x -> (x -> r) -> r Source #

A function to bind an Instruction in peelEff.

rebindEff0 :: Rebinder xs (Eff xs r) Source #

A common value for the second argument of peelEff. Binds an instruction directly.

peelEff0 Source #

Arguments

:: forall k t xs a r. (a -> Eff xs r)

return the result

-> (forall x. t x -> (x -> Eff xs r) -> Eff xs r)

Handle the foremost type of an action

-> Eff ((k >: t) ': xs) a 
-> Eff xs r 

peelEff specialised for continuations with no argument

rebindEff1 :: Rebinder xs (a -> Eff xs r) Source #

A pre-defined value for the second argument of peelEff. Preserves the argument of the continuation.

peelEff1 Source #

Arguments

:: forall k t xs a b r. (a -> b -> Eff xs r)

return the result

-> (forall x. t x -> (x -> b -> Eff xs r) -> b -> Eff xs r)

Handle the foremost type of an action

-> Eff ((k >: t) ': xs) a 
-> b 
-> Eff xs r 

peelEff specialised for 1-argument continuation

rebindEff2 :: Rebinder xs (a -> b -> Eff xs r) Source #

A pre-defined value for the second argument of peelEff. Preserves two arguments of the continuation.

leaveEff :: Eff '[] a -> a Source #

Reveal the final result of Eff.

retractEff :: forall k m a. Monad m => Eff '[k >: m] a -> m a Source #

Tear down an action using the Monad instance of the instruction.

Anonymous actions

data Action (args :: [Type]) a r where Source #

Anonymous representation of instructions.

Constructors

AResult :: Action '[] a a 
AArgument :: x -> Action xs a r -> Action (x ': xs) a r 

type family Function args r :: Type where ... Source #

Function [a, b, c] r is a -> b -> c -> r

Equations

Function '[] r = r 
Function (x ': xs) r = x -> Function xs r 

runAction :: Function xs (f a) -> Action xs a r -> f r Source #

Pass the arguments of Action to the supplied function.

(@!?) :: FieldName k -> Function xs (f a) -> Field (Interpreter f) (k :> Action xs a) infix 1 Source #

Create a Field of a Interpreter for an Action.

peelAction Source #

Arguments

:: forall k ps q xs a r. (forall x. Instruction xs x -> (x -> r) -> r)

Re-bind an unrelated action

-> (a -> r)

return the result

-> Function ps ((q -> r) -> r)

Handle the foremost action

-> Eff ((k >: Action ps q) ': xs) a 
-> r 

Specialised version of peelEff for Actions. You can pass a function a -> b -> ... -> (q -> r) -> r as a handler for Action '[a, b, ...] q.

peelAction0 Source #

Arguments

:: forall k ps q xs a. Function ps (Eff xs q)

Handle the foremost action

-> Eff ((k >: Action ps q) ': xs) a 
-> Eff xs a 

Non continuation-passing variant of peelAction.

transformers-compatible actions and handlers

Reader

type ReaderEff = (:~:) Source #

The reader monad is characterised by a type equality between the result type and the enviroment type.

askEff :: forall k r xs. Lookup xs k (ReaderEff r) => Proxy k -> Eff xs r Source #

Fetch the environment.

asksEff :: forall k r xs a. Lookup xs k (ReaderEff r) => Proxy k -> (r -> a) -> Eff xs a Source #

Pass the environment to a function.

localEff :: forall k r xs a. Lookup xs k (ReaderEff r) => Proxy k -> (r -> r) -> Eff xs a -> Eff xs a Source #

Modify the enviroment locally.

runReaderEff :: forall k r xs a. Eff ((k >: ReaderEff r) ': xs) a -> r -> Eff xs a Source #

Run the frontal reader effect.

State

type State s = StateT s Identity #

A state monad parameterized by the type s of the state to carry.

The return function leaves the state unchanged, while >>= uses the final state of the first computation as the initial state of the second.

getEff :: forall k s xs. Lookup xs k (State s) => Proxy k -> Eff xs s Source #

Get the current state.

getsEff :: forall k s a xs. Lookup xs k (State s) => Proxy k -> (s -> a) -> Eff xs a Source #

Pass the current state to a function.

putEff :: forall k s xs. Lookup xs k (State s) => Proxy k -> s -> Eff xs () Source #

Replace the state with a new value.

modifyEff :: forall k s xs. Lookup xs k (State s) => Proxy k -> (s -> s) -> Eff xs () Source #

Modify the state.

stateEff :: forall k s xs a. Lookup xs k (State s) => Proxy k -> (s -> (a, s)) -> Eff xs a Source #

Lift a state modification function.

runStateEff :: forall k s xs a. Eff ((k >: State s) ': xs) a -> s -> Eff xs (a, s) Source #

Run the frontal state effect.

execStateEff :: forall k s xs a. Eff ((k >: State s) ': xs) a -> s -> Eff xs s Source #

Run the frontal state effect and return the final state.

evalStateEff :: forall k s xs a. Eff ((k >: State s) ': xs) a -> s -> Eff xs a Source #

Run the frontal state effect and return the final result.

Writer

type WriterEff w = (,) w Source #

(,) already is a writer monad.

writerEff :: forall k w xs a. Lookup xs k (WriterEff w) => Proxy k -> (a, w) -> Eff xs a Source #

Write the second element and return the first element.

tellEff :: forall k w xs. Lookup xs k (WriterEff w) => Proxy k -> w -> Eff xs () Source #

Write a value.

listenEff :: forall k w xs a. (Lookup xs k (WriterEff w), Monoid w) => Proxy k -> Eff xs a -> Eff xs (a, w) Source #

Squash the outputs into one step and return it.

passEff :: forall k w xs a. (Lookup xs k (WriterEff w), Monoid w) => Proxy k -> Eff xs (a, w -> w) -> Eff xs a Source #

Modify the output using the function in the result.

runWriterEff :: forall k w xs a. Monoid w => Eff ((k >: WriterEff w) ': xs) a -> Eff xs (a, w) Source #

Run the frontal writer effect.

execWriterEff :: forall k w xs a. Monoid w => Eff ((k >: WriterEff w) ': xs) a -> Eff xs w Source #

Run the frontal state effect.

Maybe

type MaybeEff = Const () Source #

An effect with no result

nothingEff :: Lookup xs k MaybeEff => Proxy k -> Eff xs a Source #

Break out of the computation. Similar to Nothing.

runMaybeEff :: forall k xs a. Eff ((k >: MaybeEff) ': xs) a -> Eff xs (Maybe a) Source #

Run an effect which may fail in the name of k.

Either

type EitherEff = Const Source #

Throwing an exception

throwEff :: Lookup xs k (EitherEff e) => Proxy k -> e -> Eff xs a Source #

Throw an exception e, throwing the rest of the computation away.

catchEff :: forall k e xs a. Lookup xs k (EitherEff e) => Proxy k -> Eff xs a -> (e -> Eff xs a) -> Eff xs a Source #

Attach a handler for an exception.

runEitherEff :: forall k e xs a. Eff ((k >: EitherEff e) ': xs) a -> Eff xs (Either e a) Source #

Run an action and abort on throwEff.

mapLeftEff :: (e -> e') -> Eff ((k >: EitherEff e) ': xs) a -> Eff ((k >: EitherEff e') ': xs) a Source #

Take a function and applies it to an Either effect iff the effect takes the form Left _.

Iter

data Identity a #

Identity functor and monad. (a non-strict monad)

Since: base-4.8.0.0

Instances

Instances details
Monad Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(>>=) :: Identity a -> (a -> Identity b) -> Identity b #

(>>) :: Identity a -> Identity b -> Identity b #

return :: a -> Identity a #

Functor Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

fmap :: (a -> b) -> Identity a -> Identity b #

(<$) :: a -> Identity b -> Identity a #

MonadFix Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

mfix :: (a -> Identity a) -> Identity a #

Applicative Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

pure :: a -> Identity a #

(<*>) :: Identity (a -> b) -> Identity a -> Identity b #

liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

(*>) :: Identity a -> Identity b -> Identity b #

(<*) :: Identity a -> Identity b -> Identity a #

Foldable Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

fold :: Monoid m => Identity m -> m #

foldMap :: Monoid m => (a -> m) -> Identity a -> m #

foldMap' :: Monoid m => (a -> m) -> Identity a -> m #

foldr :: (a -> b -> b) -> b -> Identity a -> b #

foldr' :: (a -> b -> b) -> b -> Identity a -> b #

foldl :: (b -> a -> b) -> b -> Identity a -> b #

foldl' :: (b -> a -> b) -> b -> Identity a -> b #

foldr1 :: (a -> a -> a) -> Identity a -> a #

foldl1 :: (a -> a -> a) -> Identity a -> a #

toList :: Identity a -> [a] #

null :: Identity a -> Bool #

length :: Identity a -> Int #

elem :: Eq a => a -> Identity a -> Bool #

maximum :: Ord a => Identity a -> a #

minimum :: Ord a => Identity a -> a #

sum :: Num a => Identity a -> a #

product :: Num a => Identity a -> a #

Traversable Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) #

sequenceA :: Applicative f => Identity (f a) -> f (Identity a) #

mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) #

sequence :: Monad m => Identity (m a) -> m (Identity a) #

Comonad Identity 
Instance details

Defined in Control.Comonad

Methods

extract :: Identity a -> a #

duplicate :: Identity a -> Identity (Identity a) #

extend :: (Identity a -> b) -> Identity a -> Identity b #

ComonadApply Identity 
Instance details

Defined in Control.Comonad

Methods

(<@>) :: Identity (a -> b) -> Identity a -> Identity b #

(@>) :: Identity a -> Identity b -> Identity b #

(<@) :: Identity a -> Identity b -> Identity a #

Hashable1 Identity 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Identity a -> Int #

Unbox a => Vector Vector (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => MVector MVector (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Bounded a => Bounded (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Enum a => Enum (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Eq a => Eq (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(==) :: Identity a -> Identity a -> Bool #

(/=) :: Identity a -> Identity a -> Bool #

Floating a => Floating (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Fractional a => Fractional (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Integral a => Integral (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Num a => Num (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Ord a => Ord (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

compare :: Identity a -> Identity a -> Ordering #

(<) :: Identity a -> Identity a -> Bool #

(<=) :: Identity a -> Identity a -> Bool #

(>) :: Identity a -> Identity a -> Bool #

(>=) :: Identity a -> Identity a -> Bool #

max :: Identity a -> Identity a -> Identity a #

min :: Identity a -> Identity a -> Identity a #

Read a => Read (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Real a => Real (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

toRational :: Identity a -> Rational #

RealFloat a => RealFloat (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

RealFrac a => RealFrac (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

properFraction :: Integral b => Identity a -> (b, Identity a) #

truncate :: Integral b => Identity a -> b #

round :: Integral b => Identity a -> b #

ceiling :: Integral b => Identity a -> b #

floor :: Integral b => Identity a -> b #

Show a => Show (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

showsPrec :: Int -> Identity a -> ShowS #

show :: Identity a -> String #

showList :: [Identity a] -> ShowS #

Ix a => Ix (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Generic (Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep (Identity a) :: Type -> Type #

Methods

from :: Identity a -> Rep (Identity a) x #

to :: Rep (Identity a) x -> Identity a #

Semigroup a => Semigroup (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

(<>) :: Identity a -> Identity a -> Identity a #

sconcat :: NonEmpty (Identity a) -> Identity a #

stimes :: Integral b => b -> Identity a -> Identity a #

Monoid a => Monoid (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

mempty :: Identity a #

mappend :: Identity a -> Identity a -> Identity a #

mconcat :: [Identity a] -> Identity a #

Hashable a => Hashable (Identity a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Identity a -> Int #

hash :: Identity a -> Int #

Storable a => Storable (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Methods

sizeOf :: Identity a -> Int #

alignment :: Identity a -> Int #

peekElemOff :: Ptr (Identity a) -> Int -> IO (Identity a) #

pokeElemOff :: Ptr (Identity a) -> Int -> Identity a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Identity a) #

pokeByteOff :: Ptr b -> Int -> Identity a -> IO () #

peek :: Ptr (Identity a) -> IO (Identity a) #

poke :: Ptr (Identity a) -> Identity a -> IO () #

Bits a => Bits (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

FiniteBits a => FiniteBits (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Incremental a => Incremental (Identity a) 
Instance details

Defined in Data.Incremental

Associated Types

type Delta (Identity a) #

Methods

patch :: Identity a -> Delta (Identity a) -> Identity a #

diff :: Identity a -> Identity a -> Maybe (Delta (Identity a)) #

Pretty a => Pretty (Identity a)
>>> pretty (Identity 1)
1
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Identity a -> Doc ann #

prettyList :: [Identity a] -> Doc ann #

Unbox a => Unbox (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Generic1 Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep1 Identity :: k -> Type #

Methods

from1 :: forall (a :: k). Identity a -> Rep1 Identity a #

to1 :: forall (a :: k). Rep1 Identity a -> Identity a #

Wrapper Identity 
Instance details

Defined in Data.Extensible.Wrapper

Associated Types

type Repr Identity v #

Methods

_Wrapper :: forall f p (v :: k). (Functor f, Profunctor p) => Optic' p f (Identity v) (Repr Identity v) #

wrap :: forall (v :: k). Repr Identity v -> Identity v #

unwrap :: forall (v :: k). Identity v -> Repr Identity v #

newtype MVector s (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (Identity a) = MV_Identity (MVector s a)
type Rep (Identity a) 
Instance details

Defined in Data.Functor.Identity

type Rep (Identity a) = D1 ('MetaData "Identity" "Data.Functor.Identity" "base" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Delta (Identity a) 
Instance details

Defined in Data.Incremental

type Delta (Identity a) = Delta a
newtype Vector (Identity a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (Identity a) = V_Identity (Vector a)
type Rep1 Identity 
Instance details

Defined in Data.Functor.Identity

type Rep1 Identity = D1 ('MetaData "Identity" "Data.Functor.Identity" "base" 'True) (C1 ('MetaCons "Identity" 'PrefixI 'True) (S1 ('MetaSel ('Just "runIdentity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))
type Repr Identity (a :: Type) 
Instance details

Defined in Data.Extensible.Wrapper

type Repr Identity (a :: Type) = a

tickEff :: Lookup xs k Identity => Proxy k -> Eff xs () Source #

Put a milestone on a computation.

runIterEff :: Eff ((k >: Identity) ': xs) a -> Eff xs (Either a (Eff ((k >: Identity) ': xs) a)) Source #

Run a computation until the first call of tickEff.

Cont

data ContT (r :: k) (m :: k -> Type) a #

The continuation monad transformer. Can be used to add continuation handling to any type constructor: the Monad instance and most of the operations do not require m to be a monad.

ContT is not a functor on the category of monads, and many operations cannot be lifted through it.

Instances

Instances details
MonadState s m => MonadState s (ContT r m) 
Instance details

Defined in Control.Monad.State.Class

Methods

get :: ContT r m s #

put :: s -> ContT r m () #

state :: (s -> (a, s)) -> ContT r m a #

MonadReader r' m => MonadReader r' (ContT r m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ContT r m r' #

local :: (r' -> r') -> ContT r m a -> ContT r m a #

reader :: (r' -> a) -> ContT r m a #

MonadTrans (ContT r) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

lift :: Monad m => m a -> ContT r m a #

MonadCont (Eff (ContDef r (Eff xs) ': xs)) Source # 
Instance details

Defined in Data.Extensible.Effect.Default

Methods

callCC :: ((a -> Eff (ContDef r (Eff xs) ': xs) b) -> Eff (ContDef r (Eff xs) ': xs) a) -> Eff (ContDef r (Eff xs) ': xs) a #

Monad (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

(>>=) :: ContT r m a -> (a -> ContT r m b) -> ContT r m b #

(>>) :: ContT r m a -> ContT r m b -> ContT r m b #

return :: a -> ContT r m a #

Functor (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

fmap :: (a -> b) -> ContT r m a -> ContT r m b #

(<$) :: a -> ContT r m b -> ContT r m a #

MonadFail m => MonadFail (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

fail :: String -> ContT r m a #

Applicative (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

pure :: a -> ContT r m a #

(<*>) :: ContT r m (a -> b) -> ContT r m a -> ContT r m b #

liftA2 :: (a -> b -> c) -> ContT r m a -> ContT r m b -> ContT r m c #

(*>) :: ContT r m a -> ContT r m b -> ContT r m b #

(<*) :: ContT r m a -> ContT r m b -> ContT r m a #

MonadIO m => MonadIO (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

liftIO :: IO a -> ContT r m a #

MonadThrow m => MonadThrow (ContT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ContT r m a #

MonadCont (ContT r m) 
Instance details

Defined in Control.Monad.Cont.Class

Methods

callCC :: ((a -> ContT r m b) -> ContT r m a) -> ContT r m a #

PrimMonad m => PrimMonad (ContT r m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ContT r m) #

Methods

primitive :: (State# (PrimState (ContT r m)) -> (# State# (PrimState (ContT r m)), a #)) -> ContT r m a #

MonadResource m => MonadResource (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ContT r m a #

type PrimState (ContT r m) 
Instance details

Defined in Control.Monad.Primitive

type PrimState (ContT r m) = PrimState m

contEff :: Lookup xs k (ContT r m) => Proxy k -> ((a -> m r) -> m r) -> Eff xs a Source #

Place a continuation-passing action.

runContEff :: forall k r xs a. Eff ((k >: ContT r (Eff xs)) ': xs) a -> (a -> Eff xs r) -> Eff xs r Source #

Unwrap a continuation.

callCCEff :: Proxy k -> ((a -> Eff ((k >: ContT r (Eff xs)) ': xs) b) -> Eff ((k >: ContT r (Eff xs)) ': xs) a) -> Eff ((k >: ContT r (Eff xs)) ': xs) a Source #

Call a function with the current continuation as its argument