X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FbasicTypes%2FBasicTypes.lhs;h=82a446bbade39d4a92a96ec166644c998174e586;hb=fda89b29c748c6cd2fe1fdb477d5c0e8f7d32b90;hp=d19f0bd9a01deb3722eb33175a9c3159be7323db;hpb=5f34bb74bf3c7e051bce8ad343ac4bbbc11f62cd;p=ghc-hetmet.git diff --git a/ghc/compiler/basicTypes/BasicTypes.lhs b/ghc/compiler/basicTypes/BasicTypes.lhs index d19f0bd..82a446b 100644 --- a/ghc/compiler/basicTypes/BasicTypes.lhs +++ b/ghc/compiler/basicTypes/BasicTypes.lhs @@ -19,7 +19,7 @@ module BasicTypes( SYN_IE(Version), SYN_IE(Arity), SYN_IE(Module), moduleString, pprModule, Fixity(..), FixityDirection(..), - NewOrData(..) + NewOrData(..), IfaceFlavour(..) ) where IMP_Ubiq() @@ -67,6 +67,38 @@ pprModule :: PprStyle -> Module -> Doc pprModule sty m = ptext m \end{code} +%************************************************************************ +%* * +\subsection[IfaceFlavour]{IfaceFlavour} +%* * +%************************************************************************ + +The IfaceFlavour type is used mainly in an imported Name's Provenance +to say whether the name comes from a regular .hi file, or whether it comes +from a hand-written .hi-boot file. This is important, because it has to be +propagated. Suppose + + C.hs imports B + B.hs imports A + A.hs imports C {-# SOURCE -#} ( f ) + +Then in A.hi we may mention C.f, in an inlining. When compiling B we *must not* +read C.f's details from C.hi, even if the latter happens to exist from an earlier +compilation run. So we use the name "C!f" in A.hi, and when looking for an interface +file with details of C!f we look in C.hi-boot. The "!" stuff is recorded in the +IfaceFlavour in the Name of C.f in A. + +Not particularly beautiful, but it works. + +\begin{code} +data IfaceFlavour = HiFile -- The interface was read from a standard interface file + | HiBootFile -- ... or from a handwritten "hi-boot" interface file + +instance Text IfaceFlavour where -- Just used in debug prints of lex tokens + showsPrec n HiFile s = s + showsPrec n HiBootFile s = "!" ++ s +\end{code} + %************************************************************************ %* *