1 2 3 4 5 6 7 8
data Node = Node [Node] deriving Show children (Node ns) = ns descendants :: Node -> [Node] descendants n = n : (concatMap descendants $ children n) main = print $ descendants (Node [Node [Node [], Node [Node []]]])
1
[Node [Node [Node [],Node [Node []]]],Node [Node [],Node [Node []]],Node [],Node [Node []],Node []]