diff options
author | simonmar <unknown> | 2002-06-03 13:05:58 +0000 |
---|---|---|
committer | simonmar <unknown> | 2002-06-03 13:05:58 +0000 |
commit | 613f21e3e09e2f9c9b6c24490b192811b6392b21 (patch) | |
tree | 1ec348eb29f908159081b0f32381276be94e970d /src/HaddockUtil.hs | |
parent | f93641d6fe818667bde3215364b9cb2de9a4dc41 (diff) |
[haddock @ 2002-06-03 13:05:57 by simonmar]
Allow exporting of individual class methods and record selectors. For
these we have to invent the correct type signature, which we do in the
simplest possible way (i.e. no context reduction nonsense in the class
case).
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r-- | src/HaddockUtil.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs index 27595f33..b0ad3544 100644 --- a/src/HaddockUtil.hs +++ b/src/HaddockUtil.hs @@ -9,7 +9,7 @@ module HaddockUtil ( -- * Misc utilities nameOfQName, collectNames, declBinders, declMainBinder, splitTyConApp, - restrictTo, declDoc, parseModuleHeader, freeTyCons, + restrictTo, declDoc, parseModuleHeader, freeTyCons, unbang, -- * Filename utilities basename, dirname, splitFilename3, @@ -36,13 +36,16 @@ nameOfQName (UnQual n) = n collectNames :: [HsDecl] -> [HsName] collectNames ds = concat (map declBinders ds) +unbang (HsUnBangedTy ty) = ty +unbang (HsBangedTy ty) = ty + declMainBinder :: HsDecl -> Maybe HsName declMainBinder d = case d of HsTypeDecl _ n _ _ _ -> Just n HsDataDecl _ _ n _ cons _ _ -> Just n HsNewTypeDecl _ _ n _ _ _ _ -> Just n - HsClassDecl _ qt _ decls _ -> Just (exQtNm qt) + HsClassDecl _ _ n _ _ decls _ -> Just n HsTypeSig _ [n] _ _ -> Just n HsTypeSig _ ns _ _ -> error "declMainBinder" HsForeignImport _ _ _ _ n _ _ -> Just n @@ -54,7 +57,7 @@ declBinders d = HsTypeDecl _ n _ _ _ -> [n] HsDataDecl _ _ n _ cons _ _ -> n : concat (map conDeclBinders cons) HsNewTypeDecl _ _ n _ con _ _ -> n : conDeclBinders con - HsClassDecl _ qt _ decls _ -> exQtNm qt : collectNames decls + HsClassDecl _ _ n _ _ decls _ -> n : collectNames decls HsTypeSig _ ns _ _ -> ns HsForeignImport _ _ _ _ n _ _ -> [n] _ -> [] @@ -95,8 +98,8 @@ restrictTo names decl = case decl of HsDataDecl loc ctxt n xs (restrictCons names cons) drv doc HsNewTypeDecl loc ctxt n xs con drv doc -> HsDataDecl loc ctxt n xs (restrictCons names [con]) drv doc - HsClassDecl loc qt fds decls doc -> - HsClassDecl loc qt fds (restrictDecls names decls) doc + HsClassDecl loc ctxt n tys fds decls doc -> + HsClassDecl loc ctxt n tys fds (restrictDecls names decls) doc _ -> decl restrictCons :: [HsName] -> [HsConDecl] -> [HsConDecl] @@ -116,7 +119,7 @@ restrictDecls names decls = filter keep decls declDoc (HsTypeDecl _ _ _ _ d) = d declDoc (HsDataDecl _ _ _ _ _ _ d) = d declDoc (HsNewTypeDecl _ _ _ _ _ _ d) = d -declDoc (HsClassDecl _ _ _ _ d) = d +declDoc (HsClassDecl _ _ _ _ _ _ d) = d declDoc (HsTypeSig _ _ _ d) = d declDoc (HsForeignImport _ _ _ _ _ _ d) = d declDoc _ = Nothing |