instDeclATs, isIdxTyDecl,
LIE )
import RnEnv
+import RnHsDoc ( rnHsDoc )
import IfaceEnv ( ifaceExportNames )
import LoadIface ( loadSrcInterface )
import TcRnMonad hiding (LIE)
for_hs_bndrs = [nm | L _ (ForeignImport nm _ _) <- foreign_decls]
new_tc tc_decl
+ | isIdxTyDecl (unLoc tc_decl)
+ = do { main_name <- lookupFamInstDeclBndr mod main_rdr
+ ; sub_names <-
+ mappM (newTopSrcBinder mod (Just main_name)) sub_rdrs
+ ; return sub_names } -- main_name is not declared here!
+ | otherwise
= do { main_name <- newTopSrcBinder mod Nothing main_rdr
- ; sub_names <- mappM (newTopSrcBinder mod (Just main_name)) sub_rdrs
- ; if isIdxTyDecl (unLoc tc_decl) -- index type definitions
- then return ( sub_names) -- are usage occurences
- else return (main_name : sub_names) }
- where
- (main_rdr : sub_rdrs) = tyClDeclNames (unLoc tc_decl)
+ ; sub_names <-
+ mappM (newTopSrcBinder mod (Just main_name)) sub_rdrs
+ ; return (main_name : sub_names) }
+ where
+ (main_rdr : sub_rdrs) = tyClDeclNames (unLoc tc_decl)
inst_ats inst_decl
= mappM new_tc (instDeclATs (unLoc inst_decl))
; succeed_with True (name:names) }
get_item (IEVar name)
= succeed_with True [name]
-
+ get_item (IEGroup _ _)
+ = succeed_with False []
+ get_item (IEDoc _)
+ = succeed_with False []
+ get_item (IEDocNamed _)
+ = succeed_with False []
\end{code}
return (IEThingWith name names)
rnExport (IEModuleContents mod)
= return (IEModuleContents mod)
+ rnExport (IEGroup lev doc)
+ = do rn_doc <- rnHsDoc doc
+ return (IEGroup lev rn_doc)
+ rnExport (IEDoc doc)
+ = do rn_doc <- rnHsDoc doc
+ return (IEDoc rn_doc)
+ rnExport (IEDocNamed str)
+ = return (IEDocNamed str)
+
rn_exports <- mapM (wrapLocM rnExport) exports
return (Just rn_exports)
+filterOutDocs = filter notDoc
+ where
+ notDoc (L _ (IEGroup _ _)) = False
+ notDoc (L _ (IEDoc _)) = False
+ notDoc (L _ (IEDocNamed _)) = False
+ notDoc _ = True
+
mkExportNameSet :: Bool -- False => no 'module M(..) where' header at all
-> Maybe ([LIE Name], [LIE RdrName]) -- Nothing => no explicit export list
-> RnM NameSet
return (Just ([noLoc (IEVar mainName)]
,[noLoc (IEVar main_RDR_Unqual)]))
-- ToDo: the 'noLoc' here is unhelpful if 'main' turns out to be out of scope
- exports_from_avail real_exports rdr_env imports
+
+ -- we don't want to include Haddock comments
+ let real_exports' = fmap (\(a,b) -> (filterOutDocs a, filterOutDocs b)) real_exports
+
+ exports_from_avail real_exports' rdr_env imports
exports_from_avail Nothing rdr_env imports