Compositional breadth-first walks.
An experimental control structure for defining breadth-first walks in trees and graphs in a compositional manner.
Weave
is an applicative transformer for multi-level computations. This library actually defines multiple variants of Weave
with different performance profiles. The most useful ones are Weave.Lazy
and Weave.Oblivious
. Two other variants Weave.Strict
and Weave.Endless
are included mainly as curiosities.
The main application of Weave
is to define breadth-first monadic unfolds. Examples of such unfolds for some general-purpose tree structures can be found under the namespace Weave.Unfold
, for each variant of Weave
.
See also my blog post: Unfolding trees breadth-first in Haskell.
Internally, to avoid duplication, those unfolds are implemented as a Backpack mixin Weave.Unfold
. This package might not work with Stack, which doesn't support Backpack. For minimal dependencies and no backpack, the weave-core
library is also available, containing only the Weave
types.