2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
4 \section[RnNames]{Extracting imported and top-level names in scope}
11 #include "HsVersions.h"
13 import CmdLineOpts ( opt_NoImplicitPrelude, opt_WarnDuplicateExports,
14 opt_SourceUnchanged, opt_WarnUnusedBinds
17 import HsSyn ( HsModule(..), HsDecl(..), TyClDecl(..),
19 ForeignDecl(..), ForKind(..), isDynamicExtName,
20 FixitySig(..), Sig(..), ImportDecl(..),
23 import RdrHsSyn ( RdrNameIE, RdrNameImportDecl,
24 RdrNameHsModule, RdrNameHsDecl
26 import RnIfaces ( getInterfaceExports, getDeclBinders, getDeclSysBinders,
27 recordLocalSlurps, checkModUsage, findAndReadIface, outOfDate
33 import PrelInfo ( pRELUDE_Name, mAIN_Name, main_RDR )
34 import UniqFM ( lookupUFM )
35 import Bag ( bagToList )
36 import Module ( ModuleName, mkThisModule, pprModuleName, WhereFrom(..) )
38 import Name ( Name, ExportFlag(..), ImportReason(..), Provenance(..),
39 isLocallyDefined, setNameProvenance,
40 nameOccName, getSrcLoc, pprProvenance, getNameProvenance
42 import RdrName ( RdrName, rdrNameOcc, setRdrNameOcc, mkRdrQual, mkRdrUnqual, isQual, isUnqual )
43 import OccName ( setOccNameSpace, dataName )
44 import SrcLoc ( SrcLoc )
45 import NameSet ( elemNameSet, emptyNameSet )
47 import Maybes ( maybeToBool, catMaybes, mapMaybe )
48 import UniqFM ( emptyUFM, listToUFM, plusUFM_C )
49 import Unique ( getUnique )
50 import Util ( removeDups, equivClassesByUniq, sortLt )
51 import List ( partition )
56 %************************************************************************
58 \subsection{Get global names}
60 %************************************************************************
63 getGlobalNames :: RdrNameHsModule
64 -> RnMG (Maybe (GlobalRdrEnv, -- Maps all in-scope things
65 GlobalRdrEnv, -- Maps just *local* things
66 Avails, -- The exported stuff
67 AvailEnv, -- Maps a name to its parent AvailInfo
68 -- Just for in-scope things only
69 Maybe ParsedIface -- The old interface file, if any
71 -- Nothing => no need to recompile
73 getGlobalNames (HsModule this_mod _ exports imports decls _ mod_loc)
74 = -- These two fix-loops are to get the right
75 -- provenance information into a Name
76 fixRn ( \ ~(Just (rec_gbl_env, _, rec_export_avails, _, _)) ->
79 rec_unqual_fn :: Name -> Bool -- Is this chap in scope unqualified?
80 rec_unqual_fn = unQualInScope rec_gbl_env
82 rec_exp_fn :: Name -> ExportFlag
83 rec_exp_fn = mk_export_fn (availsToNameSet rec_export_avails)
85 setModuleRn this_mod $
87 -- PROCESS LOCAL DECLS
88 -- Do these *first* so that the correct provenance gets
89 -- into the global name cache.
90 importsFromLocalDecls this_mod rec_exp_fn decls
91 `thenRn` \ (local_gbl_env, local_mod_avails) ->
93 -- PROCESS IMPORT DECLS
94 -- Do the non {- SOURCE -} ones first, so that we get a helpful
95 -- warning for {- SOURCE -} ones that are unnecessary
97 (source, ordinary) = partition is_source_import all_imports
98 is_source_import (ImportDecl _ ImportByUserSource _ _ _ _) = True
99 is_source_import other = False
101 mapAndUnzipRn (importsFromImportDecl rec_unqual_fn) ordinary
102 `thenRn` \ (imp_gbl_envs1, imp_avails_s1) ->
103 mapAndUnzipRn (importsFromImportDecl rec_unqual_fn) source
104 `thenRn` \ (imp_gbl_envs2, imp_avails_s2) ->
107 -- We put the local env second, so that a local provenance
108 -- "wins", even if a module imports itself.
110 gbl_env :: GlobalRdrEnv
111 imp_gbl_env = foldr plusGlobalRdrEnv emptyRdrEnv (imp_gbl_envs2 ++ imp_gbl_envs1)
112 gbl_env = imp_gbl_env `plusGlobalRdrEnv` local_gbl_env
114 all_avails :: ExportAvails
115 all_avails = foldr plusExportAvails local_mod_avails (imp_avails_s2 ++ imp_avails_s1)
116 (_, global_avail_env) = all_avails
119 -- TRY FOR EARLY EXIT
120 -- We can't go for an early exit before this because we have to check
121 -- for name clashes. Consider:
123 -- module A where module B where
127 -- Suppose I've compiled everything up, and then I add a
128 -- new definition to module B, that defines "f".
130 -- Then I must detect the name clash in A before going for an early
131 -- exit. The early-exit code checks what's actually needed from B
132 -- to compile A, and of course that doesn't include B.f. That's
133 -- why we wait till after the plusEnv stuff to do the early-exit.
135 -- Check For eacly exit
136 checkErrsRn `thenRn` \ no_errs_so_far ->
137 if not no_errs_so_far then
138 -- Found errors already, so exit now
141 checkEarlyExit this_mod `thenRn` \ (up_to_date, old_iface) ->
143 -- Interface files are sufficiently unchanged
144 putDocRn (text "Compilation IS NOT required") `thenRn_`
148 -- RECORD BETTER PROVENANCES IN THE CACHE
149 -- The names in the envirnoment have better provenances (e.g. imported on line x)
150 -- than the names in the name cache. We update the latter now, so that we
151 -- we start renaming declarations we'll get the good names
152 -- The isQual is because the qualified name is always in scope
153 updateProvenances (concat [names | (rdr_name, names) <- rdrEnvToList gbl_env,
154 isQual rdr_name]) `thenRn_`
156 -- PROCESS EXPORT LISTS
157 exportsFromAvail this_mod exports all_avails gbl_env `thenRn` \ export_avails ->
161 returnRn (Just (gbl_env, local_gbl_env, export_avails, global_avail_env, old_iface))
164 all_imports = prel_imports ++ imports
166 -- NB: opt_NoImplicitPrelude is slightly different to import Prelude ();
167 -- because the former doesn't even look at Prelude.hi for instance declarations,
168 -- whereas the latter does.
169 prel_imports | this_mod == pRELUDE_Name ||
170 explicit_prelude_import ||
171 opt_NoImplicitPrelude
174 | otherwise = [ImportDecl pRELUDE_Name
176 False {- Not qualified -}
177 Nothing {- No "as" -}
178 Nothing {- No import list -}
181 explicit_prelude_import
182 = not (null [ () | (ImportDecl mod _ _ _ _ _) <- imports, mod == pRELUDE_Name ])
186 checkEarlyExit mod_name
187 = traceRn (text "Considering whether compilation is required...") `thenRn_`
189 -- Read the old interface file, if any, for the module being compiled
190 findAndReadIface doc_str mod_name False {- Not hi-boot -} `thenRn` \ maybe_iface ->
192 -- CHECK WHETHER WE HAVE IT ALREADY
194 Left err -> -- Old interface file not found, so we'd better bail out
195 traceRn (vcat [ptext SLIT("No old interface file for") <+> pprModuleName mod_name,
197 returnRn (outOfDate, Nothing)
200 | not opt_SourceUnchanged
201 -> -- Source code changed
202 traceRn (nest 4 (text "source file changed or recompilation check turned off")) `thenRn_`
203 returnRn (False, Just iface)
206 -> -- Source code unchanged and no errors yet... carry on
207 checkModUsage (pi_usages iface) `thenRn` \ up_to_date ->
208 returnRn (up_to_date, Just iface)
210 -- Only look in current directory, with suffix .hi
211 doc_str = sep [ptext SLIT("need usage info from"), pprModuleName mod_name]
215 importsFromImportDecl :: (Name -> Bool) -- OK to omit qualifier
217 -> RnMG (GlobalRdrEnv,
220 importsFromImportDecl is_unqual (ImportDecl imp_mod_name from qual_only as_mod import_spec iloc)
221 = pushSrcLocRn iloc $
222 getInterfaceExports imp_mod_name from `thenRn` \ (imp_mod, avails) ->
225 -- If there's an error in getInterfaceExports, (e.g. interface
226 -- file not found) we get lots of spurious errors from 'filterImports'
227 returnRn (emptyRdrEnv, mkEmptyExportAvails imp_mod_name)
230 filterImports imp_mod_name import_spec avails `thenRn` \ (filtered_avails, hides, explicits) ->
232 qualifyImports imp_mod_name
233 (not qual_only) -- Maybe want unqualified names
235 (improveAvails imp_mod iloc explicits
236 is_unqual filtered_avails)
239 improveAvails imp_mod iloc explicits is_unqual avails
240 -- We 'improve' the provenance by setting
241 -- (a) the import-reason field, so that the Name says how it came into scope
242 -- including whether it's explicitly imported
243 -- (b) the print-unqualified field
244 = map improve_avail avails
246 improve_avail (Avail n) = Avail (improve n)
247 improve_avail (AvailTC n ns) = AvailTC (improve n) (map improve ns)
249 improve name = setNameProvenance name
250 (NonLocalDef (UserImport imp_mod iloc (is_explicit name))
252 is_explicit name = name `elemNameSet` explicits
257 importsFromLocalDecls mod_name rec_exp_fn decls
258 = mapRn (getLocalDeclBinders newLocalName) decls `thenRn` \ avails_s ->
261 avails = concat avails_s
263 all_names :: [Name] -- All the defns; no dups eliminated
264 all_names = [name | avail <- avails, name <- availNames avail]
267 (_, dups) = removeDups compare all_names
269 -- Check for duplicate definitions
270 mapRn_ (addErrRn . dupDeclErr) dups `thenRn_`
272 -- Record that locally-defined things are available
273 recordLocalSlurps avails `thenRn_`
275 -- Build the environment
276 qualifyImports mod_name
277 True -- Want unqualified names
283 mod = mkThisModule mod_name
285 newLocalName rdr_name loc
286 = check_unqual rdr_name loc `thenRn_`
287 newTopBinder mod (rdrNameOcc rdr_name) `thenRn` \ name ->
288 returnRn (setNameProvenance name (LocalDef loc (rec_exp_fn name)))
290 -- There should never be a qualified name in a binding position (except in instance decls)
291 -- The parser doesn't check this because the same parser parses instance decls
292 check_unqual rdr_name loc
293 | isUnqual rdr_name = returnRn ()
294 | otherwise = qualNameErr (text "the binding for" <+> quotes (ppr rdr_name))
297 getLocalDeclBinders :: (RdrName -> SrcLoc -> RnMG Name) -- New-name function
300 getLocalDeclBinders new_name (ValD binds)
301 = mapRn do_one (bagToList (collectTopBinders binds))
303 do_one (rdr_name, loc) = new_name rdr_name loc `thenRn` \ name ->
304 returnRn (Avail name)
306 getLocalDeclBinders new_name decl
307 = getDeclBinders new_name decl `thenRn` \ maybe_avail ->
309 Nothing -> returnRn [] -- Instance decls and suchlike
310 Just avail -> getDeclSysBinders new_sys_name decl `thenRn_`
313 -- The getDeclSysBinders is just to get the names of superclass selectors
314 -- etc, into the cache
315 new_sys_name rdr_name loc = newImplicitBinder (rdrNameOcc rdr_name) loc
318 %************************************************************************
320 \subsection{Filtering imports}
322 %************************************************************************
324 @filterImports@ takes the @ExportEnv@ telling what the imported module makes
325 available, and filters it through the import spec (if any).
328 filterImports :: ModuleName -- The module being imported
329 -> Maybe (Bool, [RdrNameIE]) -- Import spec; True => hiding
330 -> [AvailInfo] -- What's available
331 -> RnMG ([AvailInfo], -- What's actually imported
332 [AvailInfo], -- What's to be hidden
333 -- (the unqualified version, that is)
334 -- (We need to return both the above sets, because
335 -- the qualified version is never hidden; so we can't
336 -- implement hiding by reducing what's imported.)
337 NameSet) -- What was imported explicitly
339 -- Complains if import spec mentions things that the module doesn't export
340 -- Warns/informs if import spec contains duplicates.
341 filterImports mod Nothing imports
342 = returnRn (imports, [], emptyNameSet)
344 filterImports mod (Just (want_hiding, import_items)) avails
345 = flatMapRn get_item import_items `thenRn` \ avails_w_explicits ->
347 (item_avails, explicits_s) = unzip avails_w_explicits
348 explicits = foldl addListToNameSet emptyNameSet explicits_s
352 -- All imported; item_avails to be hidden
353 returnRn (avails, item_avails, emptyNameSet)
355 -- Just item_avails imported; nothing to be hidden
356 returnRn (item_avails, [], explicits)
358 import_fm :: FiniteMap OccName AvailInfo
359 import_fm = listToFM [ (nameOccName name, avail)
361 name <- availNames avail]
362 -- Even though availNames returns data constructors too,
363 -- they won't make any difference because naked entities like T
364 -- in an import list map to TcOccs, not VarOccs.
366 bale_out item = addErrRn (badImportItemErr mod item) `thenRn_`
369 get_item item@(IEModuleContents _) = bale_out item
371 get_item item@(IEThingAll _)
372 = case check_item item of
373 Nothing -> bale_out item
374 Just avail@(AvailTC _ [n]) -> -- This occurs when you import T(..), but
375 -- only export T abstractly. The single [n]
376 -- in the AvailTC is the type or class itself
377 addWarnRn (dodgyImportWarn mod item) `thenRn_`
378 returnRn [(avail, [availName avail])]
379 Just avail -> returnRn [(avail, [availName avail])]
381 get_item item@(IEThingAbs n)
382 | want_hiding -- hiding( C )
383 -- Here the 'C' can be a data constructor *or* a type/class
384 = case catMaybes [check_item item, check_item (IEThingAbs data_n)] of
386 avails -> returnRn [(a, []) | a <- avails]
387 -- The 'explicits' list is irrelevant when hiding
389 data_n = setRdrNameOcc n (setOccNameSpace (rdrNameOcc n) dataName)
392 = case check_item item of
393 Nothing -> bale_out item
394 Just avail -> returnRn [(avail, availNames avail)]
397 | not (maybeToBool maybe_in_import_avails) ||
398 not (maybeToBool maybe_filtered_avail)
402 = Just filtered_avail
405 wanted_occ = rdrNameOcc (ieName item)
406 maybe_in_import_avails = lookupFM import_fm wanted_occ
408 Just avail = maybe_in_import_avails
409 maybe_filtered_avail = filterAvail item avail
410 Just filtered_avail = maybe_filtered_avail
415 %************************************************************************
417 \subsection{Qualifiying imports}
419 %************************************************************************
421 @qualifyImports@ takes the @ExportEnv@ after filtering through the import spec
422 of an import decl, and deals with producing an @RnEnv@ with the
423 right qualified names. It also turns the @Names@ in the @ExportEnv@ into
424 fully fledged @Names@.
427 qualifyImports :: ModuleName -- Imported module
428 -> Bool -- True <=> want unqualified import
429 -> Maybe ModuleName -- Optional "as M" part
430 -> [AvailInfo] -- What's to be hidden
431 -> Avails -- Whats imported and how
432 -> RnMG (GlobalRdrEnv, ExportAvails)
434 qualifyImports this_mod unqual_imp as_mod hides avails
436 -- Make the name environment. We're talking about a
437 -- single module here, so there must be no name clashes.
438 -- In practice there only ever will be if it's the module
441 -- Add the things that are available
442 name_env1 = foldl add_avail emptyRdrEnv avails
444 -- Delete things that are hidden
445 name_env2 = foldl del_avail name_env1 hides
447 -- Create the export-availability info
448 export_avails = mkExportAvails qual_mod unqual_imp name_env2 avails
450 returnRn (name_env2, export_avails)
453 qual_mod = case as_mod of
455 Just another_name -> another_name
457 add_avail :: GlobalRdrEnv -> AvailInfo -> GlobalRdrEnv
458 add_avail env avail = foldl add_name env (availNames avail)
464 env1 = addOneToGlobalRdrEnv env (mkRdrQual qual_mod occ) name
465 env2 = addOneToGlobalRdrEnv env1 (mkRdrUnqual occ) name
466 occ = nameOccName name
468 del_avail env avail = foldl delOneFromGlobalRdrEnv env rdr_names
470 rdr_names = map (mkRdrUnqual . nameOccName) (availNames avail)
473 mkEmptyExportAvails :: ModuleName -> ExportAvails
474 mkEmptyExportAvails mod_name = (unitFM mod_name [], emptyUFM)
476 mkExportAvails :: ModuleName -> Bool -> GlobalRdrEnv -> [AvailInfo] -> ExportAvails
477 mkExportAvails mod_name unqual_imp name_env avails
478 = (mod_avail_env, entity_avail_env)
480 mod_avail_env = unitFM mod_name unqual_avails
482 -- unqual_avails is the Avails that are visible in *unqualfied* form
483 -- (1.4 Report, Section 5.1.1)
485 -- import T hiding( f )
486 -- we delete f from avails
488 unqual_avails | not unqual_imp = [] -- Short cut when no unqualified imports
489 | otherwise = mapMaybe prune avails
491 prune (Avail n) | unqual_in_scope n = Just (Avail n)
492 prune (Avail n) | otherwise = Nothing
493 prune (AvailTC n ns) | null uqs = Nothing
494 | otherwise = Just (AvailTC n uqs)
496 uqs = filter unqual_in_scope ns
498 unqual_in_scope n = unQualInScope name_env n
500 entity_avail_env = listToUFM [ (name,avail) | avail <- avails,
501 name <- availNames avail]
503 plusExportAvails :: ExportAvails -> ExportAvails -> ExportAvails
504 plusExportAvails (m1, e1) (m2, e2)
505 = (plusFM_C (++) m1 m2, plusAvailEnv e1 e2)
506 -- ToDo: wasteful: we do this once for each constructor!
510 %************************************************************************
512 \subsection{Export list processing}
514 %************************************************************************
516 Processing the export list.
518 You might think that we should record things that appear in the export list
519 as ``occurrences'' (using @addOccurrenceName@), but you'd be wrong.
520 We do check (here) that they are in scope,
521 but there is no need to slurp in their actual declaration
522 (which is what @addOccurrenceName@ forces).
524 Indeed, doing so would big trouble when
525 compiling @PrelBase@, because it re-exports @GHC@, which includes @takeMVar#@,
526 whose type includes @ConcBase.StateAndSynchVar#@, and so on...
529 type ExportAccum -- The type of the accumulating parameter of
530 -- the main worker function in exportsFromAvail
531 = ([ModuleName], -- 'module M's seen so far
532 ExportOccMap, -- Tracks exported occurrence names
533 AvailEnv) -- The accumulated exported stuff, kept in an env
534 -- so we can common-up related AvailInfos
536 type ExportOccMap = FiniteMap OccName (Name, RdrNameIE)
537 -- Tracks what a particular exported OccName
538 -- in an export list refers to, and which item
539 -- it came from. It's illegal to export two distinct things
540 -- that have the same occurrence name
543 exportsFromAvail :: ModuleName
544 -> Maybe [RdrNameIE] -- Export spec
548 -- Complains if two distinct exports have same OccName
549 -- Warns about identical exports.
550 -- Complains about exports items not in scope
551 exportsFromAvail this_mod Nothing export_avails global_name_env
552 = exportsFromAvail this_mod true_exports export_avails global_name_env
554 true_exports = Just $ if this_mod == mAIN_Name
555 then [IEVar main_RDR]
556 -- export Main.main *only* unless otherwise specified,
557 else [IEModuleContents this_mod]
558 -- but for all other modules export everything.
560 exportsFromAvail this_mod (Just export_items)
561 (mod_avail_env, entity_avail_env)
563 = foldlRn exports_from_item
564 ([], emptyFM, emptyAvailEnv) export_items `thenRn` \ (_, _, export_avail_map) ->
566 export_avails :: [AvailInfo]
567 export_avails = nameEnvElts export_avail_map
569 returnRn export_avails
572 exports_from_item :: ExportAccum -> RdrNameIE -> RnMG ExportAccum
574 exports_from_item acc@(mods, occs, avails) ie@(IEModuleContents mod)
575 | mod `elem` mods -- Duplicate export of M
576 = warnCheckRn opt_WarnDuplicateExports
577 (dupModuleExport mod) `thenRn_`
581 = case lookupFM mod_avail_env mod of
582 Nothing -> failWithRn acc (modExportErr mod)
583 Just mod_avails -> foldlRn (check_occs ie) occs mod_avails
586 avails' = foldl addAvail avails mod_avails
588 returnRn (mod:mods, occs', avails')
590 exports_from_item acc@(mods, occs, avails) ie
591 | not (maybeToBool maybe_in_scope)
592 = failWithRn acc (unknownNameErr (ieName ie))
594 | not (null dup_names)
595 = addNameClashErrRn rdr_name (name:dup_names) `thenRn_`
599 -- I can't see why this should ever happen; if the thing is in scope
600 -- at all it ought to have some availability
601 | not (maybeToBool maybe_avail)
602 = pprTrace "exportsFromAvail: curious Nothing:" (ppr name)
607 = failWithRn acc (exportItemErr ie)
609 | otherwise -- Phew! It's OK! Now to check the occurrence stuff!
612 = warnCheckRn (ok_item ie avail) (dodgyExportWarn ie) `thenRn_`
613 check_occs ie occs export_avail `thenRn` \ occs' ->
614 returnRn (mods, occs', addAvail avails export_avail)
618 maybe_in_scope = lookupFM global_name_env rdr_name
619 Just (name:dup_names) = maybe_in_scope
620 maybe_avail = lookupUFM entity_avail_env name
621 Just avail = maybe_avail
622 maybe_export_avail = filterAvail ie avail
623 enough_avail = maybeToBool maybe_export_avail
624 Just export_avail = maybe_export_avail
626 ok_item (IEThingAll _) (AvailTC _ [n]) = False
627 -- This occurs when you import T(..), but
628 -- only export T abstractly. The single [n]
629 -- in the AvailTC is the type or class itself
632 check_occs :: RdrNameIE -> ExportOccMap -> AvailInfo -> RnMG ExportOccMap
633 check_occs ie occs avail
634 = foldlRn check occs (availNames avail)
637 = case lookupFM occs name_occ of
638 Nothing -> returnRn (addToFM occs name_occ (name, ie))
640 | name == name' -> -- Duplicate export
641 warnCheckRn opt_WarnDuplicateExports
642 (dupExportWarn name_occ ie ie')
643 `thenRn_` returnRn occs
645 | otherwise -> -- Same occ name but different names: an error
646 failWithRn occs (exportClashErr name_occ ie ie')
648 name_occ = nameOccName name
650 mk_export_fn :: NameSet -> (Name -> ExportFlag)
651 mk_export_fn exported_names
652 = \name -> if name `elemNameSet` exported_names
657 %************************************************************************
661 %************************************************************************
664 badImportItemErr mod ie
665 = sep [ptext SLIT("Module"), quotes (pprModuleName mod),
666 ptext SLIT("does not export"), quotes (ppr ie)]
668 dodgyImportWarn mod item = dodgyMsg (ptext SLIT("import")) item
669 dodgyExportWarn item = dodgyMsg (ptext SLIT("export")) item
671 dodgyMsg kind item@(IEThingAll tc)
672 = sep [ ptext SLIT("The") <+> kind <+> ptext SLIT("item") <+> quotes (ppr item),
673 ptext SLIT("suggests that") <+> quotes (ppr tc) <+> ptext SLIT("has constructor or class methods"),
674 ptext SLIT("but it has none; it is a type synonym or abstract type or class") ]
677 = hsep [ ptext SLIT("Unknown module in export list: module"), quotes (pprModuleName mod)]
679 exportItemErr export_item
680 = sep [ ptext SLIT("The export item") <+> quotes (ppr export_item),
681 ptext SLIT("attempts to export constructors or class methods that are not visible here") ]
683 exportClashErr occ_name ie1 ie2
684 = hsep [ptext SLIT("The export items"), quotes (ppr ie1)
685 ,ptext SLIT("and"), quotes (ppr ie2)
686 ,ptext SLIT("create conflicting exports for"), quotes (ppr occ_name)]
689 = vcat [ptext SLIT("Multiple declarations of") <+> quotes (ppr n),
690 nest 4 (vcat (map pp sorted_ns))]
692 sorted_ns = sortLt occ'ed_before (n:ns)
694 occ'ed_before a b = LT == compare (getSrcLoc a) (getSrcLoc b)
696 pp n = pprProvenance (getNameProvenance n)
698 dupExportWarn occ_name ie1 ie2
699 = hsep [quotes (ppr occ_name),
700 ptext SLIT("is exported by"), quotes (ppr ie1),
701 ptext SLIT("and"), quotes (ppr ie2)]
704 = hsep [ptext SLIT("Duplicate"),
705 quotes (ptext SLIT("Module") <+> pprModuleName mod),
706 ptext SLIT("in export list")]