import Data.TreepreOrder:: (a -> b) ->Tree a -> [b]preOrder f (Node v subtrees) = f v : subtreesTraversedwhere subtreesTraversed = concatMap (preOrder f) subtreespostOrder:: (a -> b) ->Tree a -> [b]postOrder f (Node v subtrees) = subtreesTraversed <> [f v]where subtreesTraversed = concatMap (postOrder f) subtrees