Closed AshleyYakeley closed 5 years ago
Thank you @AshleyYakeley. This was something that badly needed fixing. As you observed there is a problem that GHC only resolves which *
you mean in the renamer. Therefore I think your solution is the least bad even if I hate it when the parser code diverges from the GHC code base.
@AshleyYakeley Do you have an example which demonstrates the reduce/reduce conflict you were talking about? This does add quite a bit of complexity to the parser that I would rather avoid.
Hmm, I don't have that code anymore. However, if you try to eliminate my parser parameterisation, so that the same code can parse both *
-as-type and *
-as-type-operator, you should run in to it.
I'm guessing the problem is that, for example, type T = A * B
is ambiguous, as the *
could be either an operator, or a parameter to A
.
TBH, unless you can see a better way (I couldn't), I recommend you bite the bullet of additional parser complexity.
Well ok. This project is so much effort to maintain anyway and this will make it not much worse.
With
TypeInType
enabled, kinds are simply types. So I've madetype Kind = Type
.Parsing is trickier. The main problem is that
*
can be either a kind or a type operator, and this makes parsing tricky. To avoid a reduce/reduce conflict, I've parameterized the type-related parsing rules so as to assume that*
is a type operator in "type context" and is a kind (type) in "kind context". This isn't perfect but AFAICT should not cause backwards compatibility problems.