foldFor package:containers

Build a (possibly infinite) forest from a list of seed values. unfoldForest f seeds invokes unfoldTree on each seed value. For a monadic version, see unfoldForestM (depth-first) and unfoldForestM_BF (breadth-first).
Monadic forest builder, in depth-first order.
Monadic forest builder, in breadth-first order. See unfoldForest for more info. Implemented using an algorithm adapted from Breadth-First Numbering: Lessons from a Small Exercise in Algorithm Design, by Chris Okasaki, ICFP'00.