extensible-0.3.7: Extensible, efficient, optics-friendly data types

Safe HaskellSafe
LanguageHaskell2010

Data.Extensible.Effect

Contents

Synopsis

Documentation

data Instruction xs a where Source

A unit of effects

Constructors

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

type Eff xs = Skeleton (Instruction xs) Source

The extensible operational monad

liftEff :: forall proxy s t xs a. Associate s t xs => proxy s -> t a -> Eff xs a Source

Lift some effect to Eff

hoistEff :: forall proxy s t xs a. Associate s t xs => proxy s -> (forall x. t x -> t x) -> Eff xs a -> Eff xs a Source

handleWith :: RecordOf (Handler m) xs -> Eff xs a -> MonadView m (Eff xs) a Source

newtype Handler f g Source

Transformation between effects

Constructors

Handler 

Fields

runHandler :: forall a. g a -> f a
 

Unnamed actions

data Action args a r where Source

Unnamed action

Constructors

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

type family Function args r :: * Source

Equations

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

receive :: Functor f => Function xs (f a) -> Handler f (Action xs a) Source

Successive handling

(!-!!) :: Monad m => (forall x. t x -> m x) -> (forall x. Eff xs x -> m x) -> Eff ((s :> t) : xs) a -> m a infixr 0 Source

squash :: (forall x. t x -> Eff xs x) -> Eff ((s :> t) : xs) a -> Eff xs a Source

nihility :: Monad m => Eff `[]` a -> m a Source