summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2010-03-04 12:54:02 +0000
committersimonpj@microsoft.com <unknown>2010-03-04 12:54:02 +0000
commit903f0ad6222e735d529d775ac596e49dfe5584aa (patch)
treed03b99a2d35d1dc7219bf66661f5a7a5d3a2c83e
parentf1cc3eb980a634e62f2739a7a25387c902fa9d8a (diff)
downloadhaskell-903f0ad6222e735d529d775ac596e49dfe5584aa.tar.gz
Comments only
-rw-r--r--compiler/hsSyn/Convert.lhs23
1 files changed, 15 insertions, 8 deletions
diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs
index d14d04ac95..2a4fa724b4 100644
--- a/compiler/hsSyn/Convert.lhs
+++ b/compiler/hsSyn/Convert.lhs
@@ -844,14 +844,7 @@ isBuiltInOcc ctxt_ns occ
mk_uniq_occ :: OccName.NameSpace -> String -> Int# -> OccName.OccName
mk_uniq_occ ns occ uniq
= OccName.mkOccName ns (occ ++ '[' : shows (mk_uniq uniq) "]")
- -- The idea here is to make a name that
- -- a) the user could not possibly write, and
- -- b) cannot clash with another NameU
- -- Previously I generated an Exact RdrName with mkInternalName.
- -- This works fine for local binders, but does not work at all for
- -- top-level binders, which must have External Names, since they are
- -- rapidly baked into data constructors and the like. Baling out
- -- and generating an unqualified RdrName here is the simple solution
+ -- See Note [Unique OccNames from Template Haskell]
-- The packing and unpacking is rather turgid :-(
mk_occ :: OccName.NameSpace -> String -> OccName.OccName
@@ -872,3 +865,17 @@ mk_uniq :: Int# -> Unique
mk_uniq u = mkUniqueGrimily (I# u)
\end{code}
+Note [Unique OccNames from Template Haskell]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The idea here is to make a name that
+ a) the user could not possibly write (it has a "["
+ and letters or digits from the unique)
+ b) cannot clash with another NameU
+Previously I generated an Exact RdrName with mkInternalName. This
+works fine for local binders, but does not work at all for top-level
+binders, which must have External Names, since they are rapidly baked
+into data constructors and the like. Baling out and generating an
+unqualified RdrName here is the simple solution
+
+See also Note [Suppressing uniques in OccNames] in OccName, which
+suppresses the unique when opt_SuppressUniques is on.