Safe Haskell  None 

Language  Haskell2010 
Synopsis
 data NonDet (m :: * > *) k
 class Applicative f => Alternative (f :: Type > Type) where
 runNonDet :: (Alternative f, Applicative m) => NonDetC m a > m (f a)
 newtype NonDetC m a = NonDetC {
 runNonDetC :: forall b. (a > m b > m b) > m b > m b
Documentation
data NonDet (m :: * > *) k Source #
Instances
Effect NonDet Source #  
HFunctor NonDet Source #  
Functor (NonDet m) Source #  
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (NonDetC m) Source #  
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (OnceC m) Source #  
(Carrier sig m, Effect sig) => Carrier (Cut :+: (NonDet :+: sig)) (CutC m) Source #  
(Carrier sig m, Effect sig) => Carrier (Cull :+: (NonDet :+: sig)) (CullC m) Source #  
class Applicative f => Alternative (f :: Type > Type) where #
A monoid on applicative functors.
If defined, some
and many
should be the least solutions
of the equations:
The identity of <>
(<>) :: f a > f a > f a infixl 3 #
An associative binary operation
One or more.
Zero or more.
Instances
runNonDet :: (Alternative f, Applicative m) => NonDetC m a > m (f a) Source #
Run a NonDet
effect, collecting all branches’ results into an Alternative
functor.
Using '[]' as the Alternative
functor will produce all results, while Maybe
will return only the first. However, unlike runNonDetOnce
, this will still enumerate the entire search space before returning, meaning that it will diverge for infinite search spaces, even when using Maybe
.
run (runNonDet (pure a)) == [a]
run (runNonDet (pure a)) == Just a
A carrier for NonDet
effects based on Ralf Hinze’s design described in Deriving Backtracking Monad Transformers.
NonDetC  

Instances
MonadTrans NonDetC Source #  
Defined in Control.Effect.NonDet  
Monad (NonDetC m) Source #  
Functor (NonDetC m) Source #  
MonadFail m => MonadFail (NonDetC m) Source #  
Defined in Control.Effect.NonDet  
Applicative (NonDetC m) Source #  
MonadIO m => MonadIO (NonDetC m) Source #  
Defined in Control.Effect.NonDet  
Alternative (NonDetC m) Source #  
MonadPlus (NonDetC m) Source #  
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (NonDetC m) Source #  