Parser doesn't support doc comments on type aliases
I want to add comments to type synonyms in order to fix the following Haddock bug, but I need some help.
In the parser, the rule for type synonyms is:
'type' type '=' ctype
Types with comments are already defined as
ctypedoc and used for top-level types.
So it is tempting to just change
ctype in the above line to
ctypedoc. Indeed, I think originally
ctypedoc was defined exactly as
ctype, modulo comments. However, since then
ctype has changed.
The differences are:
ctypedisallows foralls/contexts after a contex implication (=>).
ctypeallows implicit parameters outside contexts. Seems to be disallowed by GHC later (after parsing).
ctypeallows type equalities (~) outside contexts. Seems to be disallowed later also.
I haven't seen any further differences (besides comments).
Can I just change type synonyms to use
ctypedoc without any other changes? Or do we need the features of
ctype there? If so, then changing
ctypedoc into just a commented version of
ctype would not work as a solution, since then syntax like this (from base:GHC/Desugar.hs) breaks:
(>>>) :: forall arr. Arrow arr => forall a b c. arr a b -> arr b c -> arr a c