Re: question about GADT's and error messages
Richard Eisenberg <eir <at> cis.upenn.edu>
2014-05-14 18:32:28 GMT
My understanding of OutsideIn leads me to believe that GHC 7.8 has the behavior closer to that spec. See
Section 5.2 of that paper
which is a relatively accessible explanation of this phenomenon. Daniel's explanation is essentially a
condensed version of that section.
I'm not surprised that the behavior changed between GHC 6.x and 7.x, as I believe 7.x is what brought in
OutsideIn. I don't know much about the change between 7.6 and 7.8, though. And, I agree that the
"untouchable" error messages are generally inscrutable. When I see that message in my own code, my
takeaway is generally "I have a mistake somewhere near that line", nothing more specific or useful. I've
accordingly posted a bug report #9109 (https://ghc.haskell.org/trac/ghc/ticket/9109). Please
comment there if you have either useful examples or other contributions to the fix -- it may be hard to get
this one right.
On May 13, 2014, at 5:51 PM, Andres Löh <andres <at> well-typed.com> wrote:
> Daniel is certainly right to point out general problems with GADT
> pattern matching and principal types. Nevertheless, the changing
> behaviour of GHC over time is currently a bit confusing to me.
> In GHC-6.12.3, Doaitse's program fails with three errors (demo1,
> demo2, demo4, all the GADT pattern matches without type signature),
> and the error messages are:
> GADT pattern match in non-rigid context for `AInt'