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

Safe HaskellNone
LanguageHaskell2010

Control.Effect.NonDet.Internal

Synopsis

Documentation

data NonDet (m :: * -> *) k Source #

Constructors

Empty 
Choose (Bool -> k) 
Instances
Effect NonDet Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

handle :: Functor f => f () -> (forall x. f (m x) -> n (f x)) -> NonDet m (m a) -> NonDet n (n (f a)) Source #

HFunctor NonDet Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

fmap' :: (a -> b) -> NonDet m a -> NonDet m b Source #

hmap :: (forall x. m x -> n x) -> NonDet m a -> NonDet n a Source #

Functor (NonDet m) Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

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

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

(Alternative m, Carrier sig m, Effect sig, Monad m) => Carrier (Cull :+: (NonDet :+: sig)) (CullC m) Source # 
Instance details

Defined in Control.Effect.Cull

Methods

ret :: a -> CullC m a Source #

eff :: (Cull :+: (NonDet :+: sig)) (CullC m) (CullC m a) -> CullC m a Source #

(Alternative m, Carrier sig m, Effect sig, Monad m) => Carrier (Cut :+: (NonDet :+: sig)) (CutC m) Source # 
Instance details

Defined in Control.Effect.Cut

Methods

ret :: a -> CutC m a Source #

eff :: (Cut :+: (NonDet :+: sig)) (CutC m) (CutC m a) -> CutC m a Source #

(Alternative f, Carrier sig m, Effect sig, Traversable f, Monad f, Monad m) => Carrier (NonDet :+: sig) (OnceC f m) Source # 
Instance details

Defined in Control.Effect.NonDet

Methods

ret :: a -> OnceC f m a Source #

eff :: (NonDet :+: sig) (OnceC f m) (OnceC f m a) -> OnceC f m a Source #

(Alternative f, Monad f, Traversable f, Carrier sig m, Effect sig, Applicative m) => Carrier (NonDet :+: sig) (AltC f m) Source # 
Instance details

Defined in Control.Effect.NonDet

Methods

ret :: a -> AltC f m a Source #

eff :: (NonDet :+: sig) (AltC f m) (AltC f m a) -> AltC f m a Source #

data Branch m e a Source #

The result of a nondeterministic branch of a computation.

Branch can be used to define NonDet carriers which control nondeterminism in some specific way, e.g. pruning branches according to some specific heuristic.

Constructors

None e 
Pure a 
Alt (m a) (m a) 
Instances
Functor m => Functor (Branch m e) Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

fmap :: (a -> b) -> Branch m e a -> Branch m e b #

(<$) :: a -> Branch m e b -> Branch m e a #

Foldable m => Foldable (Branch m e) Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

fold :: Monoid m0 => Branch m e m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> Branch m e a -> m0 #

foldr :: (a -> b -> b) -> b -> Branch m e a -> b #

foldr' :: (a -> b -> b) -> b -> Branch m e a -> b #

foldl :: (b -> a -> b) -> b -> Branch m e a -> b #

foldl' :: (b -> a -> b) -> b -> Branch m e a -> b #

foldr1 :: (a -> a -> a) -> Branch m e a -> a #

foldl1 :: (a -> a -> a) -> Branch m e a -> a #

toList :: Branch m e a -> [a] #

null :: Branch m e a -> Bool #

length :: Branch m e a -> Int #

elem :: Eq a => a -> Branch m e a -> Bool #

maximum :: Ord a => Branch m e a -> a #

minimum :: Ord a => Branch m e a -> a #

sum :: Num a => Branch m e a -> a #

product :: Num a => Branch m e a -> a #

Traversable m => Traversable (Branch m e) Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

traverse :: Applicative f => (a -> f b) -> Branch m e a -> f (Branch m e b) #

sequenceA :: Applicative f => Branch m e (f a) -> f (Branch m e a) #

mapM :: Monad m0 => (a -> m0 b) -> Branch m e a -> m0 (Branch m e b) #

sequence :: Monad m0 => Branch m e (m0 a) -> m0 (Branch m e a) #

(Eq e, Eq a, Eq (m a)) => Eq (Branch m e a) Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

(==) :: Branch m e a -> Branch m e a -> Bool #

(/=) :: Branch m e a -> Branch m e a -> Bool #

(Ord e, Ord a, Ord (m a)) => Ord (Branch m e a) Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

compare :: Branch m e a -> Branch m e a -> Ordering #

(<) :: Branch m e a -> Branch m e a -> Bool #

(<=) :: Branch m e a -> Branch m e a -> Bool #

(>) :: Branch m e a -> Branch m e a -> Bool #

(>=) :: Branch m e a -> Branch m e a -> Bool #

max :: Branch m e a -> Branch m e a -> Branch m e a #

min :: Branch m e a -> Branch m e a -> Branch m e a #

(Show e, Show a, Show (m a)) => Show (Branch m e a) Source # 
Instance details

Defined in Control.Effect.NonDet.Internal

Methods

showsPrec :: Int -> Branch m e a -> ShowS #

show :: Branch m e a -> String #

showList :: [Branch m e a] -> ShowS #

branch :: (e -> a) -> (b -> a) -> (m b -> m b -> a) -> Branch m e b -> a Source #

Case analysis for Branch, taking a value to use for Cut, a value to use for None, and a function to apply to the contents of Pure.

branch None Pure Alt a == (a :: Branch e [] a)
branch (applyFun f) (applyFun g) (applyFun2 h) (None a :: Branch [] a) == applyFun f a
branch (applyFun f) (applyFun g) (applyFun2 h) (Pure a :: Branch [] a) == applyFun g a
branch (applyFun f) (applyFun g) (applyFun2 h) (Alt a b :: Branch [] a) == applyFun2 h a b

runBranch :: Alternative m => (e -> m a) -> Branch m e a -> m a Source #

Interpret a Branch into an underlying Alternative context.