X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FbasicTypes%2FOccName.lhs;h=00a46f0605ecb68c4b2a7b140a1602eb2019a17a;hb=834e82079c32fa24eb6e0beb6f202add9379dc49;hp=29a6bbc2fb3ba77ea140f9d9b574ff1caf5d1f5c;hpb=8e67f5502e2e316245806ee3735a2f41a844b611;p=ghc-hetmet.git diff --git a/ghc/compiler/basicTypes/OccName.lhs b/ghc/compiler/basicTypes/OccName.lhs index 29a6bbc..00a46f0 100644 --- a/ghc/compiler/basicTypes/OccName.lhs +++ b/ghc/compiler/basicTypes/OccName.lhs @@ -27,7 +27,7 @@ module OccName ( foldOccSet, isEmptyOccSet, intersectOccSet, intersectsOccSet, mkOccName, mkOccFS, mkSysOcc, mkSysOccFS, mkFCallOcc, mkKindOccFS, - mkVarOcc, mkVarOccEncoded, + mkVarOcc, mkVarOccEncoded, mkTyVarOcc, mkSuperDictSelOcc, mkDFunOcc, mkForeignExportOcc, mkDictOcc, mkIPOcc, mkWorkerOcc, mkMethodOcc, mkDefaultMethodOcc, mkDerivedTyConOcc, mkClassTyConOcc, mkClassDataConOcc, mkSpecOcc, @@ -62,6 +62,7 @@ import Char ( isDigit, isUpper, isLower, isAlphaNum, ord, chr, digitToInt ) import Util ( thenCmp ) import Unique ( Unique, mkUnique, Uniquable(..) ) import BasicTypes ( Boxity(..), Arity ) +import StaticFlags ( opt_PprStyle_Debug ) import UniqFM import UniqSet import FastString @@ -93,7 +94,7 @@ type EncodedString = String -- Encoded form pprEncodedFS :: EncodedFS -> SDoc pprEncodedFS fs = getPprStyle $ \ sty -> - if userStyle sty + if userStyle sty || dumpStyle sty -- ftext (decodeFS fs) would needlessly pack the string again then text (decode (unpackFS fs)) else ftext fs @@ -241,6 +242,9 @@ mkOccName ns s = mkSysOcc ns (encode s) mkVarOcc :: UserFS -> OccName mkVarOcc fs = mkSysOccFS varName (encodeFS fs) +mkTyVarOcc :: UserFS -> OccName +mkTyVarOcc fs = mkSysOccFS tvName (encodeFS fs) + mkVarOccEncoded :: EncodedFS -> OccName mkVarOccEncoded fs = mkSysOccFS varName fs \end{code} @@ -498,7 +502,7 @@ mk_simple_deriv sp px occ = mk_deriv sp px (occNameString occ) -- Data constructor workers are made by setting the name space -- of the data constructor OccName (which should be a DataName) --- to DataName +-- to VarName mkDataConWorkerOcc datacon_occ = setOccNameSpace varName datacon_occ \end{code} @@ -521,9 +525,22 @@ mkLocalOcc uniq occ \begin{code} mkDFunOcc :: EncodedString -- Typically the class and type glommed together e.g. "OrdMaybe" - -> OccName -- "$fOrdMaybe" + -- Only used in debug mode, for extra clarity + -> Bool -- True <=> hs-boot instance dfun + -> Int -- Unique index + -> OccName -- "$f3OrdMaybe" + +-- In hs-boot files we make dict funs like $fx7ClsTy, which get bound to the real +-- thing when we compile the mother module. Reason: we don't know exactly +-- what the mother module will call it. -mkDFunOcc string = mk_deriv VarName "$f" string +mkDFunOcc info_str is_boot index + = mk_deriv VarName prefix string + where + prefix | is_boot = "$fx" + | otherwise = "$f" + string | opt_PprStyle_Debug = show index ++ info_str + | otherwise = show index \end{code} We used to add a '$m' to indicate a method, but that gives rise to bad