Portability | portable |
---|---|
Stability | experimental |
Maintainer | Sebastian Fischer (sebf@informatik.uni-kiel.de) |
This library provides an implementation of the MonadPlus type class that enumerates the levels of the search space and allows to implement breadth-first search.
The implementation is inspired by Mike Spivey and Silvija Seres: cf. Chapter 9 of the book 'The Fun of Programming'.
Warning: Levels
is only a monad when the results of the
enumeration functions are interpreted as a multiset, i.e., a valid
transformation according to the monad laws may change the order of
the results.
- data Levels a
- levels :: Levels a -> [[a]]
- breadthFirstSearch :: Levels a -> [a]
- levelDiagonalisation :: Levels a -> [a]
Documentation
Non-Deterministic computations of type Levels a
can be searched
level-wise.
levels :: Levels a -> [[a]]Source
The function levels
yields the results of a non-deterministic
computation grouped in levels.
breadthFirstSearch :: Levels a -> [a]Source
The function breadthFirstSearch
enumerates the results of a
non-deterministic computation in breadth-first order.
levelDiagonalisation :: Levels a -> [a]Source
The function levelDiagonalisation
enumerates the results of a
non-deterministic computation by diagonally interleaving the
results of all levels.