|
|
|
|
|
by g___
2973 days ago
|
|
Right, you can have rose trees without polymorphic recursion: data Tree1 a = Leaf1 a | Node1 [Tree1 a] flatten :: Tree1 -> [a] But this type needs it: data Tree2 a = Leaf2 a | Node2 (Tree2 [a]) flatten2 :: Tree2 -> [a] Tree1 can vary in depth between nodes, while Tree2 is either a, [a], [[a]], [[[a]]] etc. |
|