X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FOccName.lhs;h=0d1cb37949b5fa47fa104783bc7cdabf3cb96c14;hb=30098da67fd3ce50ef5a110f57c1780002f83615;hp=48137c6ea210da3d314bad4525cd719af64b9bed;hpb=d5bba9ee196f64a077e922680b16fe6f28fb79db;p=ghc-hetmet.git diff --git a/compiler/basicTypes/OccName.lhs b/compiler/basicTypes/OccName.lhs index 48137c6..0d1cb37 100644 --- a/compiler/basicTypes/OccName.lhs +++ b/compiler/basicTypes/OccName.lhs @@ -27,12 +27,13 @@ module OccName ( setOccNameSpace, -- ** Derived OccNames - mkDataConWrapperOcc, mkWorkerOcc, mkDefaultMethodOcc, mkDerivedTyConOcc, - mkNewTyCoOcc, + mkDataConWrapperOcc, mkWorkerOcc, mkDefaultMethodOcc, + mkDerivedTyConOcc, mkNewTyCoOcc, mkClassTyConOcc, mkClassDataConOcc, mkDictOcc, mkIPOcc, mkSpecOcc, mkForeignExportOcc, mkGenOcc1, mkGenOcc2, mkDataTOcc, mkDataCOcc, mkDataConWorkerOcc, - mkSuperDictSelOcc, mkLocalOcc, mkMethodOcc, + mkSuperDictSelOcc, mkLocalOcc, mkMethodOcc, mkInstTyTcOcc, + mkInstTyCoOcc, -- ** Deconstruction occNameFS, occNameString, occNameSpace, @@ -441,7 +442,8 @@ mkDictOcc = mk_simple_deriv varName "$d" mkIPOcc = mk_simple_deriv varName "$i" mkSpecOcc = mk_simple_deriv varName "$s" mkForeignExportOcc = mk_simple_deriv varName "$f" -mkNewTyCoOcc = mk_simple_deriv tcName "Co" +mkNewTyCoOcc = mk_simple_deriv tcName ":Co" +mkInstTyCoOcc = mk_simple_deriv tcName ":Co" -- derived from rep ty -- Generic derivable classes mkGenOcc1 = mk_simple_deriv varName "$gfrom" @@ -477,6 +479,16 @@ mkLocalOcc uniq occ -- that need encoding (e.g. 'z'!) \end{code} +Derive a name for the representation type constructor of a data/newtype +instance. + +\begin{code} +mkInstTyTcOcc :: Int -- Index + -> OccName -- Family name (e.g. "Map") + -> OccName -- Nice unique version (":R23Map") +mkInstTyTcOcc index occ + = mk_deriv tcName (":R" ++ show index) (occNameString occ) +\end{code} \begin{code} mkDFunOcc :: String -- Typically the class and type glommed together e.g. "OrdMaybe"