Don't split the arg types in a PatSyn signature
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 19 May 2016 14:02:09 +0000 (15:02 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 24 May 2016 08:50:26 +0000 (09:50 +0100)
commit03d8960388d64f5d5c9617dd0e21555e9e987e26
tree76d6d552796f420653f3c694af8c01cc9cf1ec42
parent4f5b33529b9e13b49a3ee00e9116b0edc9df1234
Don't split the arg types in a PatSyn signature

This patch fixes Trac #11977, and #12108, rather satisfactorily
maily by deleting code!

  pattern P :: Eq a => a -> a -> Int

The idea is simply /not/ to split the bit after the '=>' into the
pattern argument types, but to keep the (a->a->Int) part
un-decomposed, in the patsig_body_ty field of a TcPatSynInfo.

There is one awkward wrinkle, which is that we can't split the
implicitly-bound type variables into existential and universal until
we know which types are arguments and which are part of the result.
So we postpone the decision until we have the declaration in hand.
See TcPatSyn Note [The pattern-synonym signature splitting rule]
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcPatSyn.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcType.hs
testsuite/tests/patsyn/should_compile/T11977.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_compile/T12108.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_compile/all.T