effin-0.2.1.1: A Typeable-free implementation of extensible effects

Safe HaskellNone
LanguageHaskell2010

Control.Effect.List

Synopsis

Documentation

class Member List l => EffectList l

Instances

Member (* -> *) List l => EffectList l 

data List a

A nondeterminism (backtracking) effect.

Instances

Functor List 
type Is (* -> *) List f 

runList :: Effect (List :+ l) a -> Effect l [a]

Obtains all possible values from a computation parameterized by a nondeterminism effect.

choose :: EffectList l => [a] -> Effect l a

Nondeterministically chooses a value from the input list.

never :: EffectList l => Effect l a

Describes a nondeterministic computation that never returns a value.

select :: EffectList l => [Effect l a] -> Effect l a

Nondeterministically chooses a value from a list of computations.

class (EffectList l, Member Cut l) => CutEffect l

Instances

(EffectList l, Member (* -> *) Cut l) => CutEffect l 

data Cut a

Describes a Prolog-like cut effect. This effect must be used with the List effect.

Instances

runCut :: EffectList l => Effect (Cut :+ l) a -> Effect l a

Handles the Cut effect. cuts have no effect beyond the scope of the computation passed to this function.

cut :: CutEffect l => Effect l ()

Prevents backtracking past the point this value was invoked, in the style of Prolog's "!" operator.

cutFalse :: CutEffect l => Effect l a

Prevents backtracking past the point this value was invoked. Unlike Prolog's "!" operator, cutFalse will cause the current computation to fail immediately, instead of when it backtracks.