Created
December 23, 2016 21:40
-
-
Save deque-blog/72eb67aa745b4a91a368945eafb35f56 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
treeWalkM :: Tree a -> [a] | |
treeWalkM EmptyTree = [] | |
treeWalkM (Tree root) = treeWalkM' root | |
treeWalkM' :: Node a -> [a] | |
treeWalkM' n = runCont (loop n) id | |
where | |
loop (Node v cs) = do | |
rs <- mapM loop cs | |
return (v : concat rs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment