X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcEnv.lhs;h=7828394b7b2d7e9faf85f6f5d2a0130bc1aabc52;hb=0cb269be72ffe42498c74d5be845eb27d8818423;hp=1d093e2e7c4d1aa2a2760c25def972c16e72be7a;hpb=129e40f1ba90cdccee79009a33482dcfd537fd88;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcEnv.lhs b/compiler/typecheck/TcEnv.lhs index 1d093e2..7828394 100644 --- a/compiler/typecheck/TcEnv.lhs +++ b/compiler/typecheck/TcEnv.lhs @@ -38,7 +38,7 @@ module TcEnv( topIdLvl, -- New Ids - newLocalName, newDFunName + newLocalName, newDFunName, newFamInstTyConName ) where #include "HsVersions.h" @@ -66,11 +66,13 @@ import InstEnv ( Instance, DFunId, instanceDFunId, instanceHead ) import DataCon ( DataCon ) import TyCon ( TyCon ) import Class ( Class ) -import Name ( Name, NamedThing(..), getSrcLoc, nameModule ) +import Name ( Name, NamedThing(..), getSrcLoc, nameModule, + nameOccName ) import PrelNames ( thFAKE ) import NameEnv -import OccName ( mkDFunOcc, occNameString ) -import HscTypes ( extendTypeEnvList, lookupType, TyThing(..), ExternalPackageState(..) ) +import OccName ( mkDFunOcc, occNameString, mkInstTyTcOcc ) +import HscTypes ( extendTypeEnvList, lookupType, TyThing(..), + ExternalPackageState(..) ) import SrcLoc ( SrcLoc, Located(..) ) import Outputable \end{code} @@ -611,6 +613,19 @@ newDFunName clas (ty:_) loc newDFunName clas [] loc = pprPanic "newDFunName" (ppr clas <+> ppr loc) \end{code} +Make a name for the representation tycon of a data/newtype instance. It's an +*external* name, like otber top-level names, and hence must be made with +newGlobalBinder. + +\begin{code} +newFamInstTyConName :: Name -> SrcLoc -> TcM Name +newFamInstTyConName tc_name loc + = do { index <- nextDFunIndex + ; mod <- getModule + ; let occ = nameOccName tc_name + ; newGlobalBinder mod (mkInstTyTcOcc index occ) Nothing loc } +\end{code} + %************************************************************************ %* *