Safe Haskell | None |
---|---|

Language | Haskell2010 |

# Documentation

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

## Instances

Effect NonDet Source # | |

HFunctor NonDet Source # | |

Functor (NonDet m) Source # | |

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

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

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

(Alternative f, Monad f, Traversable f, Carrier sig m, Effect sig, Applicative m) => Carrier (NonDet :+: sig) (AltC f m) 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.

## Instances

Functor m => Functor (Branch m e) Source # | |

Foldable m => Foldable (Branch m e) Source # | |

Defined in Control.Effect.NonDet.Internal 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 # | |

Traversable m => Traversable (Branch m e) Source # | |

Defined in Control.Effect.NonDet.Internal | |

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

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

Defined in Control.Effect.NonDet.Internal | |

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

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.