Parse type operators left-associatively
GHC always parses term-level operators left-associatively because it doesn't know their fixity, and then reassociates them in the renamer. Type operators undergo a similar process, except they are parsed right-associatively. This inconsistency must be fixed if we are to unify term/type grammars. There are two options:
- a) Change the parsing of term-level operators to be right-associative
- b) Change the parsing of type-level operators to be left-associative
Option (b) is preferable because, according to Happy's documentation:
Happy is more efficient at parsing left-recursive rules; they result in a constant stack-space parser, whereas right-recursive rules require stack space proportional to the length of the list being parsed.
Edited by Vladislav Zavialov