Created
March 1, 2011 12:40
-
-
Save danieldk/849066 to your computer and use it in GitHub Desktop.
Fold for rose tree zippers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tzFold :: (a -> TreePos Full b -> a) -> a -> TreePos Full b -> a | |
tzFold f acc t = | |
foldSiblings $ foldChildren $ f acc t | |
where | |
foldChildren acc' = | |
case firstChild t of | |
Just c -> tzFold f acc' c | |
Nothing -> acc' | |
foldSiblings acc' = | |
case next t of | |
Just s -> tzFold f acc' s | |
Nothing -> acc' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment