StrictData and the parser

Edward Z. Yang ezyang at mit.edu
Thu Jun 4 20:30:19 UTC 2015


Excerpts from Brandon Allbery's message of 2015-06-04 13:06:52 -0700:
> Looks to me like it's confused about whether a ~ is part of an equality
> constraint or is a laziness annotation. The former would be illegal at that
> point, though, I'd think? Somewhere it believes a constraint might be
> possible there, via btype.
> 
> As ezyang says in the message I see just came in, you'll need extra
> production rules to distinguish that top level. Although I'd wonder why it
> believes an equality constraint is acceptable there in the first place; is
> that a lurking bug in the parser?

In general, the parser is more liberal than is actually required; we
can give better error messages this way.

Second, here is where it's ambiguous:

    T a ~b

where T is a TyCon.  Does this parse as

    T a (~b)

or

    T a ~ b

Parser doesn't currently distinguish these cases. 

Edward


More information about the ghc-devs mailing list