use nowrap on pre-blocks
[wix.git] / src / FromTree.lhs
1 \begin{code}
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.
5
6 module FromTree
7 where
8 import Edu_Berkeley_Sbp_Haskell_SBP
9
10 class FromTree a where
11  fromTree  :: Tree   -> a
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
18
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
23
24 instance FromTree  Int where
25   fromTree  t = read $ fromTree t
26 instance FromTrees Int where
27   fromTrees t = read $ fromTrees t
28
29 \end{code}