Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data NonDet m k
- 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
- class Applicative f => Alternative (f :: Type -> Type) where
- class (HFunctor sig, Monad m) => Carrier sig m | m -> sig
- class Member (sub :: (* -> *) -> * -> *) sup
- run :: PureC a -> a
NonDet effect
Instances
Effect NonDet Source # | |
HFunctor NonDet Source # | |
Functor m => Functor (NonDet m) Source # | |
Generic1 (NonDet m :: Type -> Type) 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 # | |
type Rep1 (NonDet m :: Type -> Type) Source # | |
Defined in Control.Effect.NonDet type Rep1 (NonDet m :: Type -> Type) = D1 (MetaData "NonDet" "Control.Effect.NonDet" "fused-effects-0.5.0.0-inplace" False) (C1 (MetaCons "Empty" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Choose" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (((->) Bool :: Type -> Type) :.: Rec1 m))) |
NonDet carrier
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 # | |
MonadFix m => MonadFix (NonDetC m) Source # | |
Defined in Control.Effect.NonDet | |
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 # | |
Re-exports
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
class (HFunctor sig, Monad m) => Carrier sig m | m -> sig Source #
The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the eff
method.