As GHC documentation (section 7.4.4, Type operators) says:
"There is now some potential ambiguity in import and export lists; for example if you write import M( (+) ) do you mean the function (+) or the type constructor (+)? The default is the former, but with -XExplicitNamespaces (which is implied by -XExplicitTypeOperators) GHC allows you to specify the latter by preceding it with the keyword type"
Turns out this ambiguity causes 4 of 6 reduce/reduce conflicts in GHC parser. All 4 conflicts arise from a single production:
qcname : qvar | oqtycon
Recursive inlining of 'qvar' and 'oqtycon' helps reveal the faulty productions:
qcname : ... | '(' QVARSYM ')' | '(' VARSYM ')' | '(' '*' ')' | '(' '-' ')'
These productions can either be parsed as variable or type constructor, but variable constuctor is always preferred. My patch removes ambiguity while preserving the existing behaviour:
- all unambigous productions are left as-is
- ambigous productions for variable constuctors are left
- ambigous productions for type constructors are removed (there's no way they could be triggered)