extensible-effects-3.0.0.0: An Alternative to Monad Transformers

Safe HaskellSafe
LanguageHaskell2010

Control.Eff.Choose

Contents

Description

Nondeterministic choice effect

Synopsis

Documentation

newtype Choose a Source #

Non-determinism (choice)

choose lst non-deterministically chooses one value from the lst choose [] thus corresponds to failure Unlike Reader, Choose is not a GADT because the type of values returned in response to a (Choose a) request is just a, without any constraints.

Constructors

Choose [a] 

Instances

(MonadBase m m, SetMember (* -> *) (Lift *) (Lift * m) r, MonadBaseControl m (Eff r)) => MonadBaseControl m (Eff ((:) (* -> *) Choose r)) Source # 

Associated Types

type StM (Eff (((* -> *) ': Choose) r) :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (Eff (((* -> *) ': Choose) r)) m -> m a) -> Eff (((* -> *) ': Choose) r) a #

restoreM :: StM (Eff (((* -> *) ': Choose) r)) a -> Eff (((* -> *) ': Choose) r) a #

type StM (Eff ((:) (* -> *) Choose r)) a Source # 
type StM (Eff ((:) (* -> *) Choose r)) a = StM (Eff r) [a]

choose :: Member Choose r => [a] -> Eff r a Source #

choose lst non-deterministically chooses one value from the lst choose [] thus corresponds to failure

makeChoice :: forall a r. Eff (Choose ': r) a -> Eff r [a] Source #

Run a nondeterministic effect, returning all values.

mzero' :: Member Choose r => Eff r a Source #

MonadPlus-like operators are expressible via choose

mplus' :: Member Choose r => Eff r a -> Eff r a -> Eff r a Source #

MonadPlus-like operators are expressible via choose

Orphan instances

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

MonadPlus-like operators are expressible via choose

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 Choose r => MonadPlus (Eff r) Source # 

Methods

mzero :: Eff r a #

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