aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockUtil.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-07-03 16:01:08 +0000
committersimonmar <unknown>2002-07-03 16:01:08 +0000
commit4e2b9ae6205b247183350e4e0127c7137e54b2e5 (patch)
tree9bfaa1b526d3cb8758acee1be091fd1b4d4a500f /src/HaddockUtil.hs
parent45290d2e6e2e4558f4469a9fc19403d80117223d (diff)
[haddock @ 2002-07-03 16:01:07 by simonmar]
Handle import specs properly, include 'hiding'. Haddock now has a complete implementation of the Haskell module system (more or less; I won't claim it's 100% correct).
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r--src/HaddockUtil.hs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs
index 633fc36f..1e8e2ca8 100644
--- a/src/HaddockUtil.hs
+++ b/src/HaddockUtil.hs
@@ -8,8 +8,8 @@
module HaddockUtil (
-- * Misc utilities
- nameOfQName, collectNames, declBinders, declMainBinder, splitTyConApp,
- restrictTo, declDoc, parseModuleHeader, freeTyCons, unbang,
+ nameOfQName, collectNames, declBinders, declMainBinder, declSubBinders,
+ splitTyConApp, restrictTo, declDoc, parseModuleHeader, freeTyCons, unbang,
-- * Filename utilities
basename, dirname, splitFilename3,
@@ -26,6 +26,7 @@ import HsSyn
import FiniteMap
import List ( intersect )
+import Maybe
import IO ( hPutStr, stderr )
import System
import RegexString
@@ -44,6 +45,8 @@ collectNames ds = concat (map declBinders ds)
unbang (HsUnBangedTy ty) = ty
unbang (HsBangedTy ty) = ty
+declBinders d = maybeToList (declMainBinder d) ++ declSubBinders d
+
declMainBinder :: HsDecl -> Maybe HsName
declMainBinder d =
case d of
@@ -56,15 +59,15 @@ declMainBinder d =
HsForeignImport _ _ _ _ n _ _ -> Just n
_ -> Nothing
-declBinders :: HsDecl -> [HsName]
-declBinders d =
+declSubBinders :: HsDecl -> [HsName]
+declSubBinders d =
case d of
- HsTypeDecl _ n _ _ _ -> [n]
- HsDataDecl _ _ n _ cons _ _ -> n : concat (map conDeclBinders cons)
- HsNewTypeDecl _ _ n _ con _ _ -> n : conDeclBinders con
- HsClassDecl _ _ n _ _ decls _ -> n : collectNames decls
- HsTypeSig _ ns _ _ -> ns
- HsForeignImport _ _ _ _ n _ _ -> [n]
+ HsTypeDecl _ n _ _ _ -> []
+ HsDataDecl _ _ n _ cons _ _ -> concat (map conDeclBinders cons)
+ HsNewTypeDecl _ _ n _ con _ _ -> conDeclBinders con
+ HsClassDecl _ _ n _ _ decls _ -> collectNames decls
+ HsTypeSig _ ns _ _ -> []
+ HsForeignImport _ _ _ _ n _ _ -> []
_ -> []
conDeclBinders (HsConDecl _ n _ _ _ _) = [n]