fused-effects-1.0.0.0: A fast, flexible, fused effect system.

Control.Effect.Cull

Contents

Description

Provides an effect to cull choices in a given nondeterministic context. This effect is used in concert with NonDet.

Computations run inside a call to cull will return at most one result.

Predefined carriers:

Since: 0.1.2.0

Synopsis

# Cull effect

data Cull m k Source #

Cull effects are used with Choose to provide control over branching.

Since: 0.1.2.0

Constructors

 Cull (m a) (a -> m k)
Instances
 Source # Instance detailsDefined in Control.Effect.Cull Methodsthread :: (Functor ctx, Monad m) => ctx () -> (forall x. ctx (m x) -> n (ctx x)) -> Cull m a -> Cull n (ctx a) Source # Source # Instance detailsDefined in Control.Effect.Cull Methodshmap :: Functor m => (forall x. m x -> n x) -> Cull m a -> Cull n a Source # Functor m => Functor (Cull m) Source # Instance detailsDefined in Control.Effect.Cull Methodsfmap :: (a -> b) -> Cull m a -> Cull m b #(<\$) :: a -> Cull m b -> Cull m a # (Algebra sig m, Effect sig) => Algebra (Cull :+: (NonDet :+: sig)) (CullC m) Source # Instance detailsDefined in Control.Carrier.Cull.Church Methodsalg :: (Cull :+: (NonDet :+: sig)) (CullC m) a -> CullC m a Source #

cull :: Has Cull sig m => m a -> m a Source #

Cull nondeterminism in the argument, returning at most one result.

cull (pure a <|> m) <|> n = pure a <|> n


Since: 0.1.2.0

# Re-exports

class (HFunctor sig, Monad m) => Algebra sig m | m -> sig Source #

The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the alg method.

Since: 1.0.0.0

Minimal complete definition

alg

Instances

type Has eff sig m = (Members eff sig, Algebra sig m) Source #

m is a carrier for sig containing eff.

Note that if eff is a sum, it will be decomposed into multiple Member constraints. While this technically allows one to combine multiple unrelated effects into a single Has constraint, doing so has two significant drawbacks:

1. Due to a problem with recursive type families, this can lead to significantly slower compiles.
2. It defeats ghc’s warnings for redundant constraints, and thus can lead to a proliferation of redundant constraints as code is changed.

run :: Identity a -> a Source #

Run an action exhausted of effects to produce its final result value.

Since: 1.0.0.0