extensible-effects-2.0.1.0: An Alternative to Monad Transformers

Safe HaskellSafe
LanguageHaskell2010

Control.Eff.NdetEff

Contents

Description

Another implementation of nondeterministic choice effect

Synopsis

Documentation

data NdetEff a where Source #

A different implementation, more directly mapping to MonadPlus interface

Constructors

MZero :: NdetEff a 
MPlus :: NdetEff Bool 

makeChoiceA0 :: Alternative f => Eff (NdetEff ': r) a -> Eff r (f a) Source #

An interpreter The following is very simple, but leaks a lot of memory The cause probably is mapping every failure to empty It takes then a lot of timne and space to store those empty

makeChoiceA :: Alternative f => Eff (NdetEff ': r) a -> Eff r (f a) Source #

A different implementation, more involved but faster and taking much less (100 times) less memory. The benefit of the effect framework is that we can have many interpreters.

msplit :: Member NdetEff r => Eff r a -> Eff r (Maybe (a, Eff r a)) Source #

ifte :: Member NdetEff r => Eff r a -> (a -> Eff r b) -> Eff r b -> Eff r b Source #

once :: Member NdetEff r => Eff r a -> Eff r a Source #

Orphan instances

Member NdetEff r => Alternative (Eff r) Source # 

Methods

empty :: Eff r a #

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

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

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

Member NdetEff r => MonadPlus (Eff r) Source # 

Methods

mzero :: Eff r a #

mplus :: Eff r a -> Eff r a -> Eff r a #