4 import Edu_Berkeley_Sbp_Haskell_SBP
8 class FromTrees a where
9 fromTrees :: [Tree] -> a
10 instance FromTree a => FromTree [a] where
11 fromTree (Tree _ c _) = map fromTree c
12 instance FromTree a => FromTrees [a] where
13 fromTrees c = map fromTree c
15 instance FromTree String where
16 fromTree (Tree h c _) = h++(concatMap fromTree c)
17 instance FromTrees String where
18 fromTrees ts = concatMap (fromTree :: Tree -> String) ts
20 instance FromTree Int where
21 fromTree t = read $ fromTree t
22 instance FromTrees Int where
23 fromTrees t = read $ fromTrees t