Safe Haskell | None |
---|
- class Applicative f => Unfolder f where
- chooseDefault :: (Monad m, Unfolder m) => [m x] -> m x
- boundedEnum :: forall f a. (Unfolder f, Bounded a, Enum a) => f a
- newtype Left x = L {}
- newtype Right x = R {}
- newtype Random g m a = Random {}
- newtype BFS f x = BFS {}
- runBFS :: Alternative f => BFS f x -> f x
- packBFS :: f x -> BFS f x
Documentation
class Applicative f => Unfolder f whereSource
Unfolders provide a way to unfold data structures. The minimal implementation is choose
.
Choose one of the values from the list.
chooseInt :: Int -> f IntSource
Given a number n
, return a number between '0' and 'n - 1'.
Unfolder [] | Don't choose but return all items. |
Unfolder Right | Always choose the last item. |
Unfolder Left | Always choose the first item. |
Unfolder m => Unfolder (Reverse m) | |
(Alternative f, Unfolder f) => Unfolder (BFS f) | Choose between values of a given depth only. |
(Monad m, Unfolder m) => Unfolder (StateT s m) | |
Unfolder m => Unfolder (ReaderT r m) | |
Unfolder m => Unfolder (ContT r m) | |
(Unfolder p, Applicative q) => Unfolder (Compose p q) | |
(Unfolder p, Unfolder q) => Unfolder (Product p q) | |
(Functor m, Monad m, RandomGen g) => Unfolder (Random g m) | Choose randomly. |
chooseDefault :: (Monad m, Unfolder m) => [m x] -> m xSource
boundedEnum :: forall f a. (Unfolder f, Bounded a, Enum a) => f aSource
If a datatype is bounded and enumerable, we can use chooseInt
to generate a value.
Return a generator of values of a given depth.
Returns Nothing
if there are no values of that depth or deeper.
Functor f => Functor (BFS f) | |
Alternative f => Applicative (BFS f) | |
(Alternative f, Unfolder f) => Unfolder (BFS f) | Choose between values of a given depth only. |
runBFS :: Alternative f => BFS f x -> f xSource