X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FDataCon.lhs;h=550be30b411851d76f7c0d2375866d8b0ed26a28;hb=9c54ee0c9e25617b2a9ad4cdd9d3a6354e2edc0f;hp=a83d5f894c44a6b9d310a2bb3b65a81879b99f8a;hpb=ff8e1d01524b48e028b09e2b04b2e5303cb6d95f;p=ghc-hetmet.git diff --git a/compiler/basicTypes/DataCon.lhs b/compiler/basicTypes/DataCon.lhs index a83d5f8..550be30 100644 --- a/compiler/basicTypes/DataCon.lhs +++ b/compiler/basicTypes/DataCon.lhs @@ -43,6 +43,11 @@ import ListSetOps import Util import Maybes import FastString +import PackageConfig +import Module + +import Data.Char +import Data.Word \end{code} @@ -518,19 +523,6 @@ mk_dict_strict_mark pred | isStrictPred pred = MarkedStrict dataConName :: DataCon -> Name dataConName = dcName --- generate a name in the format: package:Module.OccName --- and the unique identity of the name -dataConIdentity :: DataCon -> String -dataConIdentity dataCon - = prettyName - where - prettyName = pretty packageModule ++ "." ++ pretty occ - nm = getName dataCon - packageModule = nameModule nm - occ = getOccName dataCon - pretty :: Outputable a => a -> String - pretty = showSDoc . ppr - dataConTag :: DataCon -> ConTag dataConTag = dcTag @@ -694,6 +686,19 @@ dataConRepArgTys :: DataCon -> [Type] dataConRepArgTys dc = dcRepArgTys dc \end{code} +The string :. identifying a constructor, which is attached +to its info table and used by the GHCi debugger and the heap profiler. We want +this string to be UTF-8, so we get the bytes directly from the FastStrings. + +\begin{code} +dataConIdentity :: DataCon -> [Word8] +dataConIdentity dc = bytesFS (packageIdFS (modulePackageId mod)) ++ + fromIntegral (ord ':') : bytesFS (moduleNameFS (moduleName mod)) ++ + fromIntegral (ord '.') : bytesFS (occNameFS (nameOccName name)) + where name = dataConName dc + mod = nameModule name +\end{code} + \begin{code} isTupleCon :: DataCon -> Bool