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

Safe HaskellNone
LanguageHaskell2010

Control.Effect.List

Contents

Synopsis

Documentation

class Member List l => EffectList l Source #

Instances

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

data List a Source #

A nondeterminism (backtracking) effect.

Instances

type Is (* -> *) List f Source # 
type Is (* -> *) List f

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

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

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

Nondeterministically chooses a value from the input list.

never :: EffectList l => Effect l a Source #

Describes a nondeterministic computation that never returns a value.

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

Nondeterministically chooses a value from a list of computations.

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

Instances

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

data Cut a Source #

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

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

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

cut :: CutEffect l => Effect l () Source #

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

cutFalse :: CutEffect l => Effect l a Source #

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.

Orphan instances

EffectList l => Alternative (Effect l) Source # 

Methods

empty :: Effect l a #

(<|>) :: Effect l a -> Effect l a -> Effect l a #

some :: Effect l a -> Effect l [a] #

many :: Effect l a -> Effect l [a] #

EffectList l => MonadPlus (Effect l) Source # 

Methods

mzero :: Effect l a #

mplus :: Effect l a -> Effect l a -> Effect l a #