Safe Haskell | Safe-Inferred |
---|---|
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
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 | |
MonadFail m => MonadFail (NonDetC m) Source # | |
Defined in Control.Carrier.NonDet.Church | |
MonadFix m => MonadFix (NonDetC m) Source # | Separate fixpoints are computed for each branch. |
Defined in Control.Carrier.NonDet.Church | |
MonadIO m => MonadIO (NonDetC m) Source # | |
Defined in Control.Carrier.NonDet.Church | |
Alternative (NonDetC m) Source # | |
Applicative (NonDetC m) Source # | |
Functor (NonDetC m) Source # | |
Monad (NonDetC m) Source # | |
MonadPlus (NonDetC m) Source # | |
Algebra sig m => Algebra (NonDet :+: sig) (NonDetC m) Source # | |
NonDet effects
module Control.Effect.NonDet