Ticket #3097 (closed merge: wontfix)
Parser doesn't support doc comments on type aliases
| Reported by: | waern | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.10 branch |
| Component: | Compiler | Version: | 6.11 |
| Keywords: | Haddock | Cc: | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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:
- ctype disallows foralls/contexts after a contex implication (=>).
- ctype allows implicit parameters outside contexts. Seems to be disallowed by GHC later (after parsing).
- ctype allows 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
