Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
Cull (m a) (a -> k) |
cull :: (Carrier sig m, Member Cull sig) => m a -> m a Source #
Cull nondeterminism in the argument, returning at most one result.
run (runNonDet (runCull (cull (pure a <|> pure b)))) == [a]
run (runNonDet (runCull (cull (pure a <|> pure b) <|> pure c))) == [a, c]
run (runNonDet (runCull (cull (asum (map pure (repeat a)))))) == [a]
runCull :: Alternative m => CullC m a -> m a Source #
Instances
MonadTrans CullC Source # | |
Defined in Control.Effect.Cull | |
Monad (CullC m) Source # | |
Functor (CullC m) Source # | |
MonadFail m => MonadFail (CullC m) Source # | |
Defined in Control.Effect.Cull | |
Applicative (CullC m) Source # | |
MonadIO m => MonadIO (CullC m) Source # | |
Defined in Control.Effect.Cull | |
Alternative (CullC m) Source # | |
MonadPlus (CullC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Cull :+: (NonDet :+: sig)) (CullC m) Source # | |
runNonDetOnce :: (Alternative f, Carrier sig m, Effect sig) => OnceC m a -> m (f a) Source #
Run a NonDet
effect, returning the first successful result in an Alternative
functor.
Unlike runNonDet
, this will terminate immediately upon finding a solution.
run (runNonDetOnce (asum (map pure (repeat a)))) == [a]
run (runNonDetOnce (asum (map pure (repeat a)))) == Just a
Instances
Monad (OnceC m) Source # | |
Functor (OnceC m) Source # | |
MonadFail m => MonadFail (OnceC m) Source # | |
Defined in Control.Effect.Cull | |
Applicative (OnceC m) Source # | |
MonadIO m => MonadIO (OnceC m) Source # | |
Defined in Control.Effect.Cull | |
Alternative (OnceC m) Source # | |
MonadPlus (OnceC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (OnceC m) Source # | |