--- /dev/null
+\begin{code}
+module Util where
+import SBP
+import List(sort)
+
+indent [] = []
+indent ('\n':q) = "\n "++(indent q)
+indent (a:b) = a:(indent b)
+
+join c [] = ""
+join c [x] = x
+join c (x:y) = x++c++(join c y)
+
+class FromTree a where
+ fromTree :: Tree -> a
+class FromTrees a where
+ fromTrees :: [Tree] -> a
+instance FromTree a => FromTree [a] where
+ fromTree (Tree _ c _) = map fromTree c
+instance FromTree String where
+ fromTree (Tree h c _) = h++(concatMap fromTree c)
+instance FromTrees String where
+ fromTrees ts = concatMap (fromTree :: Tree -> String) ts
+
+uniq l = rmdups $ sort l
+ where
+ rmdups [] = []
+ rmdups [x] = [x]
+ rmdups (x:y:rest) | x==y = rmdups (x:rest)
+ | otherwise = x:(rmdups (y:rest))
+
+\end{code}
\ No newline at end of file