StrictData and the parser
Edward Z. Yang
ezyang at mit.edu
Fri Jun 5 00:07:47 UTC 2015
Excerpts from Johan Tibell's message of 2015-06-04 16:52:30 -0700:
> I guess we should parse it as T a (~b), just as we have unary minus bind
> "tighter" with the following token.
Not in all contexts.
It is true that if you have 'data SLPair a b = SLP a ~ b' you want to
parse 'SLP a (~b)'
But if you have 'Maybe a ~ b' you want to parse '(Maybe a) ~ b'.
But in GADTs, if you have
data SLPair a b where
SLP :: a -> ~ b -> SLPair a b
you want a -> (~ b) -> SLPair a b
If the twiddle is not immediately after an arrow you don't want
data T a b where
T :: a -> a ~ b -> SLPair a b
you want T :: a -> (a ~ b) -> SLPair a b
More information about the ghc-devs