From abc0dd597a1c88c9f966b8586d8b1ca8fbabb937 Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 15 Jul 2002 09:19:38 +0000 Subject: [haddock @ 2002-07-15 09:19:38 by simonmar] Fix a bug in mkExportItems when processing a module without an explicit export list. We were placing one copy of a declaration for each binder in the declaration, which for a data type would mean one copy of the whole declaration per constructor or record selector. --- src/Main.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 214c0001..dcaf1fcc 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -410,7 +410,7 @@ mkExportItems mod_map this_mod orig_env decl_map sub_map decls return (concat exps) where everything_local_exported = -- everything exported - return (fullContentsOfThisModule this_mod decl_map) + return (fullContentsOfThisModule this_mod decls) lookupExport (HsEVar x) = declWith x (Just []) lookupExport (HsEAbs t) = declWith t (Just []) @@ -449,7 +449,7 @@ mkExportItems mod_map this_mod orig_env decl_map sub_map decls | otherwise = all_subs_of_qname mod_map t fullContentsOf m - | m == this_mod = return (fullContentsOfThisModule this_mod decl_map) + | m == this_mod = return (fullContentsOfThisModule this_mod decls) | otherwise = case lookupFM mod_map m of Just iface @@ -469,10 +469,11 @@ mkExportItems mod_map this_mod orig_env decl_map sub_map decls Just iface -> lookupFM (iface_decls iface) n Nothing -> Nothing -fullContentsOfThisModule mod decl_map = - map mkExportItem (filter (keepDecl.snd) (fmToList decl_map)) - where mkExportItem (x,HsDocGroup loc lev doc) = ExportGroup lev "" doc - mkExportItem (x,decl) = ExportDecl (Qual mod x) decl +fullContentsOfThisModule mod decls = + map mkExportItem (filter keepDecl decls) + where mkExportItem (HsDocGroup loc lev doc) = ExportGroup lev "" doc + mkExportItem decl = ExportDecl (Qual mod x) decl + where Just x = declMainBinder decl keepDecl HsTypeSig{} = True keepDecl HsTypeDecl{} = True -- cgit v1.2.3