Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Cull m k = Cull (m a) (a -> m k)
- cull :: (Carrier sig m, Member Cull sig) => m a -> m a
- runCull :: Alternative m => CullC m a -> m a
- newtype CullC m a = CullC {}
- runNonDetOnce :: (Alternative f, Carrier sig m, Effect sig) => OnceC m a -> m (f a)
- newtype OnceC m a = OnceC {}
- class (HFunctor sig, Monad m) => Carrier sig m | m -> sig
- class Member (sub :: (* -> *) -> * -> *) sup
- run :: PureC a -> a
Cull effect
Cull (m a) (a -> m 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]
Cull carriers
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 # | |
MonadFix m => MonadFix (CullC m) Source # | |
Defined in Control.Effect.Cull | |
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 # | |
MonadFix m => MonadFix (OnceC m) Source # | |
Defined in Control.Effect.Cull | |
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 # | |
Re-exports
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.