Confusing error message when universally quantifying unused type variables

Alexander Berntsen alexander at plaimi.net
Tue Oct 20 11:27:27 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 20/10/15 13:23, Joachim Breitner wrote:
> This is expected. If there is any ? in the type, then GHC wants
> all variables to be properly bound. This is not related to whether
> a is used or not:
I see. I still think the error message could be more specific though...


>> Furthermore the first code snippet I gave also strikes me as 
>> nonsensical; if someone has code like that, it is probably the
>> result of a typo. Should we really permit it? Is there a
>> motivating reason for permitting it? If no, I suggest it be an
>> error. (My understanding of the 2010 report was that it *isn't*
>> permitted, but perhaps I read it wrong.)
> You mean type constraints involving an otherwise unused type
> variable? This seems to be unrelated to the question of foralls.
It is. It just hit me while reading through my email before sending it.

> But indeed the 2010 report writes “The context cx must only contain
> type variables referenced in t.” 
> https://www.haskell.org/report/node/2010/haskellch4.html#x10-660004.1.3
>
> 
and even with -XHaskell2010, this is accepted.
Then I understood it correctly. I think we should fix this.

> Might be worth a ticket, although I would not be surprised if some
> of the type class hackers around here finds a use case for this
> :-)
If there is a usecase for this, it could be a pragma. GHC should not
accept it by default though.
- -- 
Alexander
alexander at plaimi.net
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJWJiUfAAoJENQqWdRUGk8BwE8QALSsg6Tn0Xet7v4uJ6xRj2Hi
Ai2D70snCRi3kVrIbtwN3ZiOQfmLPTqQbohfICMac1AwWA8P9QQ+FKvii5UNh9SG
0YdAOp6SFyIrKU9SobfEiDSM4D2KZJ/6JsJFh4nmmDQWneA7YgGM1Gk2zFlMiW1e
oYyERM3qTcMKo1g/qwQOEIvGiWhdbxBQ04NbuOf+cSLAb/rKeBEylzG7dbmtCJeN
LFUZPwMOUNFSSXvaM5xGzeSppd+dxEd1zk9JR2lm0Q4J8gRfz3Upibi7tWDtJnia
IW0znMAPRXdcjxaonXsmUC1rK+Ub9Ey3Bt0lR37BzCUaAmvYgVfvzhRyDSLUrpFA
ym2sBGn75dfWJuor9kbeoQ1kRg1wPrZy9B6/4u7DBFWU2HnSreH6x/Izu741QSdZ
9xXT5caU1H/W76CybbBvnH8IUjv76SP9b83rYBFc0r/JhK3+r/nODckTrif1zAh9
2WOq6q1lo30/bURcNcx0qLZoCoOFmQtOpFTOOD84yCWAfrZ2Ybnnh8Eh/7cd5JQo
8/dIW9wFJCSBL9rX9PbuYygTEPaUHNR099QRZ5LBRp39NjFR/t+Z/gnHpnivxsz0
p12aOPbTNxCbctoeLNE2S/sw9ZDEWnTupUqhF8QLvZieVaznnqwNcsGXUd/qYPP8
Y2l0+sojeWyk8XNKNz+m
=nxvb
-----END PGP SIGNATURE-----


More information about the ghc-devs mailing list