diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-12-05 02:23:27 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-12-10 19:54:34 -0500 |
commit | 921d32381a0bdd693935aa2bada3cd76870bf2f9 (patch) | |
tree | 5a33781ff532bd4e682584c5d7a227b26a608a4b /compiler/prelude/TysWiredIn.hs | |
parent | 843ceb3892432b28628e4b4bad2c712ca371d02b (diff) | |
download | haskell-921d32381a0bdd693935aa2bada3cd76870bf2f9.tar.gz |
Ignore unary constraint tuples during typechecking (#17511)
We deliberately avoid defining a magical `Unit%` class, for reasons
that I have expounded upon in the newly added
`Note [Ignore unary constraint tuples]` in `TcHsType`. However, a
sneaky user could try to insert `Unit%` into their program by way of
Template Haskell, leading to the interface-file error observed
in #17511. To avoid this, any time we encounter a unary constraint
tuple during typechecking, we drop the surrounding constraint tuple
application. This is safe to do since `Unit% a` and `a` would be
semantically equivalent (unlike other forms of unary tuples).
Fixes #17511.
Diffstat (limited to 'compiler/prelude/TysWiredIn.hs')
-rw-r--r-- | compiler/prelude/TysWiredIn.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index de7ec7ec81..ba427efee7 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -722,9 +722,9 @@ created in Template Haskell or in, e.g., `deriving` code. There is nothing special about one-tuples in Core; in particular, they have no custom pretty-printing, just using `Unit`. -NB (Feb 16): for /constraint/ one-tuples I have 'Unit%' but no class -decl in GHC.Classes, so I think this part may not work properly. But -it's unused I think. +Note that there is *not* a unary constraint tuple, unlike for other forms of +tuples. See [Ignore unary constraint tuples] in TcHsType for more +details. See also Note [Flattening one-tuples] in MkCore and Note [Don't flatten tuples from HsSyn] in MkCore. |