1 2 3 4
data NestedList a = Elem a | List [NestedList a] flatten (Elem x) = [x] flatten (List xs) = concat $ map flatten xs