aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Dupree <id@isaac.cedarswampstudios.org>2009-08-24 01:22:44 +0000
committerIsaac Dupree <id@isaac.cedarswampstudios.org>2009-08-24 01:22:44 +0000
commita482831b5a2f9a7460f6fa5003f9593420117f73 (patch)
tree3d8a64071cb6a569e7536e26c3c588fe7fc3079e
parent9f35e27553d18b1fcaaeb02d69e29c1963af614f (diff)
refactor out subordinatesWithNoDocs
dep of inferenced-decls fix
-rw-r--r--src/Haddock/Interface/Create.hs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
index 3cfb5836..50bd3a74 100644
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -169,6 +169,19 @@ declInfos gre decls =
return (parent, (mbDoc, fnArgsDoc), subs)
+-- | If you know the HsDecl can't contain any docs
+-- (e.g., it was loaded from a .hi file and you don't have a .haddock file
+-- to help you find out about the subs or docs)
+-- then you can use this to get its subs.
+subordinatesWithNoDocs :: HsDecl Name -> [(Name, DocForDecl Name)]
+subordinatesWithNoDocs decl = map noDocs (subordinates decl)
+ where
+ -- check the condition... or shouldn't we be checking?
+ noDocs (n, doc1, doc2) | null doc1, Map.null doc2
+ = (n, noDocForDecl)
+ noDocs _ = error ("no-docs thing has docs! " ++ pretty decl)
+
+
subordinates :: HsDecl Name -> [(Name, MaybeDocStrings, Map Int HsDocString)]
subordinates (TyClD d) = classDataSubs d
subordinates _ = []
@@ -520,8 +533,7 @@ mkExportItems modMap this_mod gre exported_names decls declMap
liftErrMsg $ tell
["Warning: Couldn't find .haddock for exported "
++ exportInfoString]
- let subs = map (\(n,_,_) -> (n, noDocForDecl))
- (subordinates (unLoc hsdecl))
+ let subs = subordinatesWithNoDocs (unLoc hsdecl)
return [ mkExportDecl t (hsdecl, noDocForDecl, subs) ]
Just iface -> do
let subs = case Map.lookup t (instSubMap iface) of