Skip to content

Fix some duplication in the parser

Sebastian Graf requested to merge wip/parser-less-dup into master

D3673 experienced reduce/reduce conflicts when trying to use opt_instance for associated data families.

That was probably because the author tried to use it for Haskell98-syntax without also applying it to GADT-syntax, which actually leads to a reduce/reduce conflict. Consider the following state:

data . T = T
data . T where T :: T

The parser must decide at this point whether or not to reduce an empty opt_instance. But doing so would also commit to either Haskell98 or GADT syntax! Good thing we also accept an optional "instance" for GADT syntax, so the opt_instance is there in both productions and there's no reduce/reduce conflict anymore.

Also no need to inline opt_instance, how it used to be.

Merge request reports