fused-effects-1.1.2.0: A fast, flexible, fused effect system.
Safe HaskellNone
LanguageHaskell2010

Control.Carrier.Cull.Church

Description

A carrier for Cull and NonDet effects used in tandem (Cull :+: NonDet).

Since: 1.0.0.0

Synopsis

Cull carrier

runCull :: (m b -> m b -> m b) -> (a -> m b) -> m b -> CullC m a -> m b Source #

Run a Cull effect with continuations respectively interpreting <|>, pure, and empty. Branches outside of any cull block will not be pruned.

runCull fork leaf nil (pure a <|> empty) = leaf a `fork` nil
runCull fork leaf nil (cull (pure a <|> b)) = leaf a

Since: 1.0.0.0

runCullA :: (Alternative f, Applicative m) => CullC m a -> m (f a) Source #

Run a Cull effect, interpreting the result into an Alternative functor. Choice is handled with <|>, embedding with pure, and failure with empty.

Since: 1.0.0.0

runCullM :: (Applicative m, Monoid b) => (a -> b) -> CullC m a -> m b Source #

Run a Cull effect, mapping results into a Monoid.

Since: 1.0.0.0

newtype CullC m a Source #

Since: 1.0.0.0

Constructors

CullC (ReaderC Bool (NonDetC m) a) 

Instances

Instances details
MonadTrans CullC Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

lift :: Monad m => m a -> CullC m a #

Monad (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

(>>=) :: CullC m a -> (a -> CullC m b) -> CullC m b #

(>>) :: CullC m a -> CullC m b -> CullC m b #

return :: a -> CullC m a #

Functor (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

fmap :: (a -> b) -> CullC m a -> CullC m b #

(<$) :: a -> CullC m b -> CullC m a #

MonadFix m => MonadFix (CullC m) Source #

Separate fixpoints are computed for each branch.

Instance details

Defined in Control.Carrier.Cull.Church

Methods

mfix :: (a -> CullC m a) -> CullC m a #

MonadFail m => MonadFail (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

fail :: String -> CullC m a #

Applicative (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

pure :: a -> CullC m a #

(<*>) :: CullC m (a -> b) -> CullC m a -> CullC m b #

liftA2 :: (a -> b -> c) -> CullC m a -> CullC m b -> CullC m c #

(*>) :: CullC m a -> CullC m b -> CullC m b #

(<*) :: CullC m a -> CullC m b -> CullC m a #

MonadIO m => MonadIO (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

liftIO :: IO a -> CullC m a #

Alternative (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

empty :: CullC m a #

(<|>) :: CullC m a -> CullC m a -> CullC m a #

some :: CullC m a -> CullC m [a] #

many :: CullC m a -> CullC m [a] #

MonadPlus (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

mzero :: CullC m a #

mplus :: CullC m a -> CullC m a -> CullC m a #

Algebra sig m => Algebra (Cull :+: (NonDet :+: sig)) (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (CullC m) -> (Cull :+: (NonDet :+: sig)) n a -> ctx () -> CullC m (ctx a) Source #

Cull effect

NonDet effects