7 indent ('\n':q) = "\n "++(indent q)
8 indent (a:b) = a:(indent b)
12 join c (x:y) = x++c++(join c y)
14 class FromTree a where
16 class FromTrees a where
17 fromTrees :: [Tree] -> a
18 instance FromTree a => FromTree [a] where
19 fromTree (Tree _ c _) = map fromTree c
20 instance FromTree String where
21 fromTree (Tree h c _) = h++(concatMap fromTree c)
22 instance FromTrees String where
23 fromTrees ts = concatMap (fromTree :: Tree -> String) ts
25 uniq l = rmdups $ sort l
29 rmdups (x:y:rest) | x==y = rmdups (x:rest)
30 | otherwise = x:(rmdups (y:rest))