minor reformatting
[ghc-hetmet.git] / compiler / iface / LoadIface.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
3 %
4 \section{Dealing with interface files}
5
6 \begin{code}
7 module LoadIface (
8         loadInterface, loadInterfaceForName, loadWiredInHomeIface, 
9         loadSrcInterface, loadSysInterface, loadOrphanModules, 
10         findAndReadIface, readIface,    -- Used when reading the module's old interface
11         loadDecls, ifaceStats, discardDeclPrags,
12         initExternalPackageState
13    ) where
14
15 #include "HsVersions.h"
16
17 import {-# SOURCE #-}   TcIface( tcIfaceDecl, tcIfaceRule, tcIfaceInst )
18
19 import DynFlags         ( DynFlags(..), DynFlag( Opt_IgnoreInterfacePragmas ) )
20 import IfaceSyn         ( IfaceDecl(..), IfaceConDecl(..), IfaceClassOp(..),
21                           IfaceConDecls(..), IfaceIdInfo(..) )
22 import IfaceEnv         ( newGlobalBinder )
23 import HscTypes         ( ModIface(..), TyThing, emptyModIface, EpsStats(..),
24                           addEpsInStats, ExternalPackageState(..),
25                           PackageTypeEnv, emptyTypeEnv,  HscEnv(..),
26                           lookupIfaceByModule, emptyPackageIfaceTable,
27                           IsBootInterface, mkIfaceFixCache, 
28                           implicitTyThings 
29                          )
30
31 import BasicTypes       ( Version, Fixity(..), FixityDirection(..),
32                           isMarkedStrict )
33 import TcRnMonad
34
35 import PrelNames        ( gHC_PRIM )
36 import PrelInfo         ( ghcPrimExports )
37 import PrelRules        ( builtinRules )
38 import Rules            ( extendRuleBaseList, mkRuleBase )
39 import InstEnv          ( emptyInstEnv, extendInstEnvList )
40 import Name             ( Name {-instance NamedThing-}, getOccName,
41                           nameModule, nameIsLocalOrFrom, isWiredInName )
42 import NameEnv
43 import MkId             ( seqId )
44 import Module
45 import OccName          ( OccName, mkOccEnv, lookupOccEnv, mkClassTyConOcc, mkClassDataConOcc,
46                           mkSuperDictSelOcc, mkDataConWrapperOcc, mkDataConWorkerOcc )
47 import SrcLoc           ( importedSrcLoc )
48 import Maybes           ( MaybeErr(..) )
49 import ErrUtils         ( Message )
50 import Finder           ( findImportedModule, findExactModule,  
51                           FindResult(..), cannotFindInterface )
52 import UniqFM
53 import Outputable
54 import BinIface         ( readBinIface )
55 import Panic            ( ghcError, tryMost, showException, GhcException(..) )
56 import List             ( nub )
57 \end{code}
58
59
60 %************************************************************************
61 %*                                                                      *
62         loadSrcInterface, loadOrphanModules, loadHomeInterface
63
64                 These three are called from TcM-land    
65 %*                                                                      *
66 %************************************************************************
67
68 \begin{code}
69 -- | Load the interface corresponding to an @import@ directive in 
70 -- source code.  On a failure, fail in the monad with an error message.
71 loadSrcInterface :: SDoc -> ModuleName -> IsBootInterface -> RnM ModIface
72 loadSrcInterface doc mod want_boot  = do        
73   -- We must first find which Module this import refers to.  This involves
74   -- calling the Finder, which as a side effect will search the filesystem
75   -- and create a ModLocation.  If successful, loadIface will read the
76   -- interface; it will call the Finder again, but the ModLocation will be
77   -- cached from the first search.
78   hsc_env <- getTopEnv
79   res <- ioToIOEnv $ findImportedModule hsc_env mod Nothing
80   case res of
81     Found _ mod -> do
82       mb_iface <- initIfaceTcRn $ loadInterface doc mod (ImportByUser want_boot)
83       case mb_iface of
84         Failed err      -> failWithTc err
85         Succeeded iface -> return iface
86     err ->
87         let dflags = hsc_dflags hsc_env in
88         failWithTc (cannotFindInterface dflags mod err)
89
90 -- | Load interfaces for a collection of orphan modules.
91 loadOrphanModules :: [Module] -> TcM ()
92 loadOrphanModules mods
93   | null mods = returnM ()
94   | otherwise = initIfaceTcRn $
95                 do { traceIf (text "Loading orphan modules:" <+> 
96                                  fsep (map ppr mods))
97                    ; mappM_ load mods
98                    ; returnM () }
99   where
100     load mod   = loadSysInterface (mk_doc mod) mod
101     mk_doc mod = ppr mod <+> ptext SLIT("is a orphan-instance module")
102
103 -- | Loads the interface for a given Name.
104 loadInterfaceForName :: SDoc -> Name -> TcRn ModIface
105 loadInterfaceForName doc name
106   = do  { 
107 #ifdef DEBUG
108                 -- Should not be called with a name from the module being compiled
109           this_mod <- getModule
110         ; ASSERT2( not (nameIsLocalOrFrom this_mod name), ppr name <+> parens doc )
111 #endif
112           initIfaceTcRn $ loadSysInterface doc (nameModule name)
113     }
114
115 -- | An 'IfM' function to load the home interface for a wired-in thing,
116 -- so that we're sure that we see its instance declarations and rules
117 loadWiredInHomeIface :: Name -> IfM lcl ()
118 loadWiredInHomeIface name
119   = ASSERT( isWiredInName name )
120     do loadSysInterface doc (nameModule name); return ()
121   where
122     doc = ptext SLIT("Need home interface for wired-in thing") <+> ppr name
123
124 -- | A wrapper for 'loadInterface' that throws an exception if it fails
125 loadSysInterface :: SDoc -> Module -> IfM lcl ModIface
126 loadSysInterface doc mod_name
127   = do  { mb_iface <- loadInterface doc mod_name ImportBySystem
128         ; case mb_iface of 
129             Failed err      -> ghcError (ProgramError (showSDoc err))
130             Succeeded iface -> return iface }
131 \end{code}
132
133
134 %*********************************************************
135 %*                                                      *
136                 loadInterface
137
138         The main function to load an interface
139         for an imported module, and put it in
140         the External Package State
141 %*                                                      *
142 %*********************************************************
143
144 \begin{code}
145 loadInterface :: SDoc -> Module -> WhereFrom
146               -> IfM lcl (MaybeErr Message ModIface)
147
148 -- If it can't find a suitable interface file, we
149 --      a) modify the PackageIfaceTable to have an empty entry
150 --              (to avoid repeated complaints)
151 --      b) return (Left message)
152 --
153 -- It's not necessarily an error for there not to be an interface
154 -- file -- perhaps the module has changed, and that interface 
155 -- is no longer used
156
157 loadInterface doc_str mod from
158   = do  {       -- Read the state
159           (eps,hpt) <- getEpsAndHpt
160
161         ; traceIf (text "Considering whether to load" <+> ppr mod <+> ppr from)
162
163                 -- Check whether we have the interface already
164         ; dflags <- getDOpts
165         ; case lookupIfaceByModule dflags hpt (eps_PIT eps) mod of {
166             Just iface 
167                 -> returnM (Succeeded iface) ;  -- Already loaded
168                         -- The (src_imp == mi_boot iface) test checks that the already-loaded
169                         -- interface isn't a boot iface.  This can conceivably happen,
170                         -- if an earlier import had a before we got to real imports.   I think.
171             other -> do
172
173         { let { hi_boot_file = case from of
174                                 ImportByUser usr_boot -> usr_boot
175                                 ImportBySystem        -> sys_boot
176
177               ; mb_dep   = lookupUFM (eps_is_boot eps) (moduleName mod)
178               ; sys_boot = case mb_dep of
179                                 Just (_, is_boot) -> is_boot
180                                 Nothing           -> False
181                         -- The boot-ness of the requested interface, 
182               }         -- based on the dependencies in directly-imported modules
183
184         -- READ THE MODULE IN
185         ; read_result <- findAndReadIface doc_str mod hi_boot_file
186         ; dflags <- getDOpts
187         ; case read_result of {
188             Failed err -> do
189                 { let fake_iface = emptyModIface mod
190
191                 ; updateEps_ $ \eps ->
192                         eps { eps_PIT = extendModuleEnv (eps_PIT eps) (mi_module fake_iface) fake_iface }
193                         -- Not found, so add an empty iface to 
194                         -- the EPS map so that we don't look again
195                                 
196                 ; returnM (Failed err) } ;
197
198         -- Found and parsed!
199             Succeeded (iface, file_path)                        -- Sanity check:
200                 | ImportBySystem <- from,       --   system-importing...
201                   modulePackageId (mi_module iface) == thisPackage dflags,
202                                                 --   a home-package module...
203                   Nothing <- mb_dep             --   that we know nothing about
204                 -> returnM (Failed (badDepMsg mod))
205
206                 | otherwise ->
207
208         let 
209             loc_doc = text file_path
210         in 
211         initIfaceLcl mod loc_doc $ do
212
213         --      Load the new ModIface into the External Package State
214         -- Even home-package interfaces loaded by loadInterface 
215         --      (which only happens in OneShot mode; in Batch/Interactive 
216         --      mode, home-package modules are loaded one by one into the HPT)
217         -- are put in the EPS.
218         --
219         -- The main thing is to add the ModIface to the PIT, but
220         -- we also take the
221         --      IfaceDecls, IfaceInst, IfaceRules
222         -- out of the ModIface and put them into the big EPS pools
223
224         -- NB: *first* we do loadDecl, so that the provenance of all the locally-defined
225         ---    names is done correctly (notably, whether this is an .hi file or .hi-boot file).
226         --     If we do loadExport first the wrong info gets into the cache (unless we
227         --      explicitly tag each export which seems a bit of a bore)
228
229         ; ignore_prags <- doptM Opt_IgnoreInterfacePragmas
230         ; new_eps_decls <- loadDecls ignore_prags (mi_decls iface)
231         ; new_eps_insts <- mapM tcIfaceInst (mi_insts iface)
232         ; new_eps_rules <- if ignore_prags 
233                            then return []
234                            else mapM tcIfaceRule (mi_rules iface)
235
236         ; let { final_iface = iface {   mi_decls = panic "No mi_decls in PIT",
237                                         mi_insts = panic "No mi_insts in PIT",
238                                         mi_rules = panic "No mi_rules in PIT" } }
239
240         ; updateEps_  $ \ eps -> 
241             eps { eps_PIT       = extendModuleEnv (eps_PIT eps) mod final_iface,
242                   eps_PTE       = addDeclsToPTE   (eps_PTE eps) new_eps_decls,
243                   eps_rule_base = extendRuleBaseList (eps_rule_base eps) new_eps_rules,
244                   eps_inst_env  = extendInstEnvList  (eps_inst_env eps)  new_eps_insts,
245                   eps_stats     = addEpsInStats (eps_stats eps) (length new_eps_decls)
246                                                 (length new_eps_insts) (length new_eps_rules) }
247
248         ; return (Succeeded final_iface)
249     }}}}
250
251 badDepMsg mod 
252   = hang (ptext SLIT("Interface file inconsistency:"))
253        2 (sep [ptext SLIT("home-package module") <+> quotes (ppr mod) <+> ptext SLIT("is mentioned,"), 
254                ptext SLIT("but does not appear in the dependencies of the interface")])
255
256 -----------------------------------------------------
257 --      Loading type/class/value decls
258 -- We pass the full Module name here, replete with
259 -- its package info, so that we can build a Name for
260 -- each binder with the right package info in it
261 -- All subsequent lookups, including crucially lookups during typechecking
262 -- the declaration itself, will find the fully-glorious Name
263 -----------------------------------------------------
264
265 addDeclsToPTE :: PackageTypeEnv -> [(Name,TyThing)] -> PackageTypeEnv
266 addDeclsToPTE pte things = extendNameEnvList pte things
267
268 loadDecls :: Bool
269           -> [(Version, IfaceDecl)]
270           -> IfL [(Name,TyThing)]
271 loadDecls ignore_prags ver_decls
272    = do { mod <- getIfModule
273         ; thingss <- mapM (loadDecl ignore_prags mod) ver_decls
274         ; return (concat thingss)
275         }
276
277 loadDecl :: Bool                        -- Don't load pragmas into the decl pool
278          -> Module
279           -> (Version, IfaceDecl)
280           -> IfL [(Name,TyThing)]       -- The list can be poked eagerly, but the
281                                         -- TyThings are forkM'd thunks
282 loadDecl ignore_prags mod (_version, decl)
283   = do  {       -- Populate the name cache with final versions of all 
284                 -- the names associated with the decl
285           main_name      <- mk_new_bndr mod Nothing (ifName decl)
286         ; implicit_names <- mapM (mk_new_bndr mod (Just main_name)) (ifaceDeclSubBndrs decl)
287
288         -- Typecheck the thing, lazily
289         -- NB. firstly, the laziness is there in case we never need the
290         -- declaration (in one-shot mode), and secondly it is there so that 
291         -- we don't look up the occurrence of a name before calling mk_new_bndr
292         -- on the binder.  This is important because we must get the right name
293         -- which includes its nameParent.
294         ; thing <- forkM doc (bumpDeclStats main_name >> tcIfaceDecl stripped_decl)
295         ; let mini_env = mkOccEnv [(getOccName t, t) | t <- implicitTyThings thing]
296               lookup n = case lookupOccEnv mini_env (getOccName n) of
297                            Just thing -> thing
298                            Nothing    -> pprPanic "loadDecl" (ppr main_name <+> ppr n)
299
300         ; returnM ((main_name, thing) : [(n, lookup n) | n <- implicit_names]) }
301                 -- We build a list from the *known* names, with (lookup n) thunks
302                 -- as the TyThings.  That way we can extend the PTE without poking the
303                 -- thunks
304   where
305     stripped_decl | ignore_prags = discardDeclPrags decl
306                   | otherwise    = decl
307
308         -- mk_new_bndr allocates in the name cache the final canonical
309         -- name for the thing, with the correct 
310         --      * parent
311         --      * location
312         -- imported name, to fix the module correctly in the cache
313     mk_new_bndr mod mb_parent occ 
314         = newGlobalBinder mod occ mb_parent 
315                           (importedSrcLoc (showSDoc (ppr (moduleName mod))))
316                         -- ToDo: qualify with the package name if necessary
317
318     doc = ptext SLIT("Declaration for") <+> ppr (ifName decl)
319
320 discardDeclPrags :: IfaceDecl -> IfaceDecl
321 discardDeclPrags decl@(IfaceId {ifIdInfo = HasInfo _}) = decl { ifIdInfo = NoInfo }
322 discardDeclPrags decl                                  = decl
323
324 bumpDeclStats :: Name -> IfL ()         -- Record that one more declaration has actually been used
325 bumpDeclStats name
326   = do  { traceIf (text "Loading decl for" <+> ppr name)
327         ; updateEps_ (\eps -> let stats = eps_stats eps
328                               in eps { eps_stats = stats { n_decls_out = n_decls_out stats + 1 } })
329         }
330
331 -----------------
332 ifaceDeclSubBndrs :: IfaceDecl -> [OccName]
333 --  *Excludes* the 'main' name, but *includes* the implicitly-bound names
334 -- Deeply revolting, because it has to predict what gets bound,
335 -- especially the question of whether there's a wrapper for a datacon
336
337 ifaceDeclSubBndrs IfaceClass { ifCtxt = sc_ctxt, 
338                                ifName = cls_occ, 
339                                ifSigs = sigs }
340   = [tc_occ, dc_occ, dcww_occ] ++
341     [op | IfaceClassOp op _ _ <- sigs] ++
342     [mkSuperDictSelOcc n cls_occ | n <- [1..n_ctxt]] 
343   where
344     n_ctxt = length sc_ctxt
345     n_sigs = length sigs
346     tc_occ  = mkClassTyConOcc cls_occ
347     dc_occ  = mkClassDataConOcc cls_occ 
348     dcww_occ | is_newtype = mkDataConWrapperOcc dc_occ  -- Newtypes have wrapper but no worker
349              | otherwise  = mkDataConWorkerOcc dc_occ   -- Otherwise worker but no wrapper
350     is_newtype = n_sigs + n_ctxt == 1                   -- Sigh 
351
352 ifaceDeclSubBndrs IfaceData {ifCons = IfAbstractTyCon}
353   = []
354 -- Newtype
355 ifaceDeclSubBndrs IfaceData {ifCons = IfNewTyCon (IfVanillaCon { 
356                                                       ifConOcc = con_occ,
357                                                       ifConFields = fields})}
358   = fields ++ [con_occ, mkDataConWrapperOcc con_occ]
359         -- Wrapper, no worker; see MkId.mkDataConIds
360
361 ifaceDeclSubBndrs (IfaceData {ifCons = IfDataTyCon cons})
362   = nub (concatMap fld_occs cons)       -- Eliminate duplicate fields
363     ++ concatMap dc_occs cons
364   where
365     fld_occs (IfVanillaCon { ifConFields = fields }) = fields
366     fld_occs (IfGadtCon {})                          = []
367     dc_occs con_decl
368         | has_wrapper = [con_occ, work_occ, wrap_occ]
369         | otherwise   = [con_occ, work_occ]
370         where
371           con_occ = ifConOcc con_decl
372           strs    = ifConStricts con_decl
373           wrap_occ = mkDataConWrapperOcc con_occ
374           work_occ = mkDataConWorkerOcc con_occ
375           has_wrapper = any isMarkedStrict strs -- See MkId.mkDataConIds (sigh)
376                 -- ToDo: may miss strictness in existential dicts
377
378 ifaceDeclSubBndrs _other                      = []
379
380 \end{code}
381
382
383 %*********************************************************
384 %*                                                      *
385 \subsection{Reading an interface file}
386 %*                                                      *
387 %*********************************************************
388
389 \begin{code}
390 findAndReadIface :: SDoc -> Module
391                  -> IsBootInterface     -- True  <=> Look for a .hi-boot file
392                                         -- False <=> Look for .hi file
393                  -> TcRnIf gbl lcl (MaybeErr Message (ModIface, FilePath))
394         -- Nothing <=> file not found, or unreadable, or illegible
395         -- Just x  <=> successfully found and parsed 
396
397         -- It *doesn't* add an error to the monad, because 
398         -- sometimes it's ok to fail... see notes with loadInterface
399
400 findAndReadIface doc_str mod hi_boot_file
401   = do  { traceIf (sep [hsep [ptext SLIT("Reading"), 
402                               if hi_boot_file 
403                                 then ptext SLIT("[boot]") 
404                                 else empty,
405                               ptext SLIT("interface for"), 
406                               ppr mod <> semi],
407                         nest 4 (ptext SLIT("reason:") <+> doc_str)])
408
409         -- Check for GHC.Prim, and return its static interface
410         ; dflags <- getDOpts
411         ; if mod == gHC_PRIM
412           then returnM (Succeeded (ghcPrimIface, 
413                                    "<built in interface for GHC.Prim>"))
414           else do
415
416         -- Look for the file
417         ; hsc_env <- getTopEnv
418         ; mb_found <- ioToIOEnv (findHiFile hsc_env mod hi_boot_file)
419         ; case mb_found of {
420               Failed err -> do
421                 { traceIf (ptext SLIT("...not found"))
422                 ; dflags <- getDOpts
423                 ; returnM (Failed (cannotFindInterface dflags 
424                                         (moduleName mod) err)) } ;
425
426               Succeeded file_path -> do 
427
428         -- Found file, so read it
429         { traceIf (ptext SLIT("readIFace") <+> text file_path)
430         ; read_result <- readIface mod file_path hi_boot_file
431         ; case read_result of
432             Failed err -> returnM (Failed (badIfaceFile file_path err))
433             Succeeded iface 
434                 | mi_module iface /= mod ->
435                   return (Failed (wrongIfaceModErr iface mod file_path))
436                 | otherwise ->
437                   returnM (Succeeded (iface, file_path))
438                         -- Don't forget to fill in the package name...
439         }}}
440
441 findHiFile :: HscEnv -> Module -> IsBootInterface
442            -> IO (MaybeErr FindResult FilePath)
443 findHiFile hsc_env mod hi_boot_file
444   = do
445       maybe_found <- findExactModule hsc_env mod
446       case maybe_found of
447         Found loc mod -> return (Succeeded path)
448                 where
449                    path = addBootSuffix_maybe hi_boot_file (ml_hi_file loc)
450         err -> return (Failed err)
451 \end{code}
452
453 @readIface@ tries just the one file.
454
455 \begin{code}
456 readIface :: Module -> FilePath -> IsBootInterface 
457           -> TcRnIf gbl lcl (MaybeErr Message ModIface)
458         -- Failed err    <=> file not found, or unreadable, or illegible
459         -- Succeeded iface <=> successfully found and parsed 
460
461 readIface wanted_mod file_path is_hi_boot_file
462   = do  { dflags <- getDOpts
463         ; ioToIOEnv $ do
464         { res <- tryMost (readBinIface file_path)
465         ; case res of
466             Right iface 
467                 | wanted_mod == actual_mod -> return (Succeeded iface)
468                 | otherwise                -> return (Failed err)
469                 where
470                   actual_mod = mi_module iface
471                   err = hiModuleNameMismatchWarn wanted_mod actual_mod
472
473             Left exn    -> return (Failed (text (showException exn)))
474     }}
475 \end{code}
476
477
478 %*********************************************************
479 %*                                                       *
480         Wired-in interface for GHC.Prim
481 %*                                                       *
482 %*********************************************************
483
484 \begin{code}
485 initExternalPackageState :: ExternalPackageState
486 initExternalPackageState
487   = EPS { 
488       eps_is_boot    = emptyUFM,
489       eps_PIT        = emptyPackageIfaceTable,
490       eps_PTE        = emptyTypeEnv,
491       eps_inst_env   = emptyInstEnv,
492       eps_rule_base  = mkRuleBase builtinRules,
493         -- Initialise the EPS rule pool with the built-in rules
494       eps_stats = EpsStats { n_ifaces_in = 0, n_decls_in = 0, n_decls_out = 0
495                            , n_insts_in = 0, n_insts_out = 0
496                            , n_rules_in = length builtinRules, n_rules_out = 0 }
497     }
498 \end{code}
499
500
501 %*********************************************************
502 %*                                                       *
503         Wired-in interface for GHC.Prim
504 %*                                                       *
505 %*********************************************************
506
507 \begin{code}
508 ghcPrimIface :: ModIface
509 ghcPrimIface
510   = (emptyModIface gHC_PRIM) {
511         mi_exports  = [(gHC_PRIM, ghcPrimExports)],
512         mi_decls    = [],
513         mi_fixities = fixities,
514         mi_fix_fn  = mkIfaceFixCache fixities
515     }           
516   where
517     fixities = [(getOccName seqId, Fixity 0 InfixR)]
518                         -- seq is infixr 0
519 \end{code}
520
521 %*********************************************************
522 %*                                                      *
523 \subsection{Statistics}
524 %*                                                      *
525 %*********************************************************
526
527 \begin{code}
528 ifaceStats :: ExternalPackageState -> SDoc
529 ifaceStats eps 
530   = hcat [text "Renamer stats: ", msg]
531   where
532     stats = eps_stats eps
533     msg = vcat 
534         [int (n_ifaces_in stats) <+> text "interfaces read",
535          hsep [ int (n_decls_out stats), text "type/class/variable imported, out of", 
536                 int (n_decls_in stats), text "read"],
537          hsep [ int (n_insts_out stats), text "instance decls imported, out of",  
538                 int (n_insts_in stats), text "read"],
539          hsep [ int (n_rules_out stats), text "rule decls imported, out of",  
540                 int (n_rules_in stats), text "read"]
541         ]
542 \end{code}    
543
544
545 %*********************************************************
546 %*                                                       *
547 \subsection{Errors}
548 %*                                                       *
549 %*********************************************************
550
551 \begin{code}
552 badIfaceFile file err
553   = vcat [ptext SLIT("Bad interface file:") <+> text file, 
554           nest 4 err]
555
556 hiModuleNameMismatchWarn :: Module -> Module -> Message
557 hiModuleNameMismatchWarn requested_mod read_mod = 
558   withPprStyle defaultUserStyle $
559     -- we want the Modules below to be qualified with package names,
560     -- so reset the PrintUnqualified setting.
561     hsep [ ptext SLIT("Something is amiss; requested module ")
562          , ppr requested_mod
563          , ptext SLIT("differs from name found in the interface file")
564          , ppr read_mod
565          ]
566
567 wrongIfaceModErr iface mod_name file_path 
568   = sep [ptext SLIT("Interface file") <+> iface_file,
569          ptext SLIT("contains module") <+> quotes (ppr (mi_module iface)) <> comma,
570          ptext SLIT("but we were expecting module") <+> quotes (ppr mod_name),
571          sep [ptext SLIT("Probable cause: the source code which generated"),
572              nest 2 iface_file,
573              ptext SLIT("has an incompatible module name")
574             ]
575         ]
576   where iface_file = doubleQuotes (text file_path)
577 \end{code}