Skip to content

Ignore unary constraint tuples during typechecking (#17511)

Ryan Scott requested to merge wip/T17511 into master

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 (closed). 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 (closed).

Merge request reports