diff options
author | simonmar <unknown> | 2002-07-24 09:28:19 +0000 |
---|---|---|
committer | simonmar <unknown> | 2002-07-24 09:28:19 +0000 |
commit | 1d44cadf21cdf3d5437e6cd438723d9ce7c895e2 (patch) | |
tree | 0c0cd73c1f27124607f4e5f396d613c85920f179 /src | |
parent | f1ec1813ac8f710cc6867c2244e3e922c6675ce9 (diff) |
[haddock @ 2002-07-24 09:28:19 by simonmar]
Remove ^Ms
Diffstat (limited to 'src')
-rw-r--r-- | src/HaddockModuleTree.hs | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/HaddockModuleTree.hs b/src/HaddockModuleTree.hs index 21cd404e..d8b46871 100644 --- a/src/HaddockModuleTree.hs +++ b/src/HaddockModuleTree.hs @@ -1,25 +1,25 @@ -module HaddockModuleTree(ModuleTree(..), mkModuleTree) where
-
-import HsSyn
-
-data ModuleTree = Node String Bool [ModuleTree]
-
-mkModuleTree :: [Module] -> [ModuleTree]
-mkModuleTree mods = foldr addToTrees [] (map splitModule mods)
-
-addToTrees :: [String] -> [ModuleTree] -> [ModuleTree]
-addToTrees [] ts = ts
-addToTrees ss [] = mkSubTree ss
-addToTrees (s1:ss) (t@(Node s2 leaf subs) : ts)
- | s1 > s2 = t : addToTrees (s1:ss) ts
- | s1 == s2 = Node s2 (leaf || null ss) (addToTrees ss subs) : ts
- | otherwise = mkSubTree (s1:ss) ++ t : ts
-
-mkSubTree [] = []
-mkSubTree (s:ss) = [Node s (null ss) (mkSubTree ss)]
-
-splitModule :: Module -> [String]
-splitModule (Module mod) = split mod
- where split mod = case break (== '.') mod of
- (s1, '.':s2) -> s1 : split s2
- (s1, _) -> [s1]
\ No newline at end of file +module HaddockModuleTree(ModuleTree(..), mkModuleTree) where + +import HsSyn + +data ModuleTree = Node String Bool [ModuleTree] + +mkModuleTree :: [Module] -> [ModuleTree] +mkModuleTree mods = foldr addToTrees [] (map splitModule mods) + +addToTrees :: [String] -> [ModuleTree] -> [ModuleTree] +addToTrees [] ts = ts +addToTrees ss [] = mkSubTree ss +addToTrees (s1:ss) (t@(Node s2 leaf subs) : ts) + | s1 > s2 = t : addToTrees (s1:ss) ts + | s1 == s2 = Node s2 (leaf || null ss) (addToTrees ss subs) : ts + | otherwise = mkSubTree (s1:ss) ++ t : ts + +mkSubTree [] = [] +mkSubTree (s:ss) = [Node s (null ss) (mkSubTree ss)] + +splitModule :: Module -> [String] +splitModule (Module mod) = split mod + where split mod = case break (== '.') mod of + (s1, '.':s2) -> s1 : split s2 + (s1, _) -> [s1] |