Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- runNonDet :: (m b -> m b -> m b) -> (a -> m b) -> m b -> NonDetC m a -> m b
- runNonDetA :: (Alternative f, Applicative m) => NonDetC m a -> m (f a)
- runNonDetM :: (Applicative m, Monoid b) => (a -> b) -> NonDetC m a -> m b
- newtype NonDetC m a = NonDetC (forall b. (m b -> m b -> m b) -> (a -> m b) -> m b -> m b)
- module Control.Effect.NonDet
NonDet carrier
:: (m b -> m b -> m b) | Handles choice ( |
-> (a -> m b) | Handles embedding results ( |
-> m b | Handles failure ( |
-> NonDetC m a | A nondeterministic computation to execute |
-> m b |
Run a NonDet
effect, using the provided functions to interpret choice, leaf results, and failure.
Since: 1.0.0.0
runNonDetA :: (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, unless used with cull
, this will still enumerate the entire search space before returning, meaning that it will diverge for infinite search spaces, even when using Maybe
.
runNonDetA
(pure
a) =pure
[a]
runNonDetA
(pure
a) =pure
(Just
a)
Since: 1.0.0.0
runNonDetM :: (Applicative m, Monoid b) => (a -> b) -> NonDetC m a -> m b Source #
A carrier for NonDet
effects based on Ralf Hinze’s design described in Deriving Backtracking Monad Transformers.
Since: 1.0.0.0
NonDetC (forall b. (m b -> m b -> m b) -> (a -> m b) -> m b -> m b) |
Instances
MonadTrans NonDetC Source # | |
Defined in Control.Carrier.NonDet.Church | |
Monad (NonDetC m) Source # | |
Functor (NonDetC m) Source # | |
MonadFix m => MonadFix (NonDetC m) Source # | Separate fixpoints are computed for each branch. |
Defined in Control.Carrier.NonDet.Church | |
MonadFail m => MonadFail (NonDetC m) Source # | |
Defined in Control.Carrier.NonDet.Church | |
Applicative (NonDetC m) Source # | |
MonadIO m => MonadIO (NonDetC m) Source # | |
Defined in Control.Carrier.NonDet.Church | |
Alternative (NonDetC m) Source # | |
MonadPlus (NonDetC m) Source # | |
(Algebra sig m, Effect sig) => Algebra (NonDet :+: sig) (NonDetC m) Source # | |
NonDet effects
module Control.Effect.NonDet