2 -- Copyright 2008 the Contributors, as shown in the revision logs.
3 -- Licensed under the Apache Public Source License 2.0 ("the License").
4 -- You may not use this file except in compliance with the License.
8 import Edu_Berkeley_Sbp_Haskell_SBP
10 class FromTree a where
12 class FromTrees a where
13 fromTrees :: [Tree] -> a
14 instance FromTree a => FromTree [a] where
15 fromTree (Tree _ c _) = map fromTree c
16 instance FromTree a => FromTrees [a] where
17 fromTrees c = map fromTree c
19 instance FromTree String where
20 fromTree (Tree h c _) = h++(concatMap fromTree c)
21 instance FromTrees String where
22 fromTrees ts = concatMap (fromTree :: Tree -> String) ts
24 instance FromTree Int where
25 fromTree t = read $ fromTree t
26 instance FromTrees Int where
27 fromTrees t = read $ fromTrees t