Fix tree traversal breaking on errors

This commit is contained in:
Kirill Andreev 2020-07-10 12:45:49 +04:00
parent e5ec32f46a
commit 5737cd5686
No known key found for this signature in database
GPG Key ID: CF7DA79DE4785A47

View File

@ -213,7 +213,9 @@ traverseMany visitors orElse = go
case tree of case tree of
Tree (Right (r, union)) -> do Tree (Right (r, union)) -> do
union' <- traverse go union union' <- traverse go union
return $ Tree (Right (orElse r, union')) return $ Tree $ Right (orElse r, union')
Tree (Left err) -> do
return $ Tree $ Left $ fmap orElse err
-- | Make a tree out of a layer and an info. -- | Make a tree out of a layer and an info.
mk :: (Functor f, Element f fs) => info -> f (Tree fs info) -> Tree fs info mk :: (Functor f, Element f fs) => info -> f (Tree fs info) -> Tree fs info