summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a88a919)
Excluding 'unfoldTreeM' and 'unfoldForestM' is overkill for nhc98.
A simpler workaround for the type inference bug is just to omit one
type signature from the mutually recursive pair.
flatten, levels,
-- * Building trees
unfoldTree, unfoldForest,
flatten, levels,
-- * Building trees
unfoldTree, unfoldForest,
unfoldTreeM, unfoldForestM,
unfoldTreeM, unfoldForestM,
unfoldTreeM_BF, unfoldForestM_BF,
) where
unfoldTreeM_BF, unfoldForestM_BF,
) where
unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a
unfoldForest f = map (unfoldTree f)
unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a
unfoldForest f = map (unfoldTree f)
-- | Monadic tree builder, in depth-first order
unfoldTreeM :: Monad m => (b -> m (a, [b])) -> b -> m (Tree a)
unfoldTreeM f b = do
-- | Monadic tree builder, in depth-first order
unfoldTreeM :: Monad m => (b -> m (a, [b])) -> b -> m (Tree a)
unfoldTreeM f b = do
return (Node a ts)
-- | Monadic forest builder, in depth-first order
return (Node a ts)
-- | Monadic forest builder, in depth-first order
unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a)
unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m (Forest a)
-unfoldForestM f = mapM (unfoldTreeM f)
+unfoldForestM f = mapM (unfoldTreeM f)
-- | Monadic tree builder, in breadth-first order,
-- using an algorithm adapted from
-- | Monadic tree builder, in breadth-first order,
-- using an algorithm adapted from