Warn instead of stopping on misplaced Haddock comments
Given a simple module like
```
module H where
data F = F () -- ^ Comment for first type argument
()
```
and trying to run Haddock on it, we'll get back
```
/tmp/H.hs:4:12: parse error on input ‘(’
```
The error message is rather sub-par in this scenario. It'd be great if we could instead print a warning saying that a Haddock comment is unexpected in that position and then continue on parsing.
Best case scenario would be a more informative message such as “Documenting each constructor argument is not supported” but that might be quite a bit harder.
Filing on GHC Trac as it's the parser that needs changing I believe.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 7.9 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Warn instead of stopping on misplaced Haddock comments","status":"New","operating_system":"","component":"Compiler (Parser)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.9","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"Given a simple module like\r\n\r\n{{{\r\nmodule H where\r\n\r\ndata F = F () -- ^ Comment for first type argument\r\n ()\r\n}}}\r\n\r\nand trying to run Haddock on it, we'll get back\r\n\r\n{{{\r\n/tmp/H.hs:4:12: parse error on input ‘(’\r\n}}}\r\n\r\nThe error message is rather sub-par in this scenario. It'd be great if we could instead print a warning saying that a Haddock comment is unexpected in that position and then continue on parsing.\r\n\r\nBest case scenario would be a more informative message such as “Documenting each constructor argument is not supported” but that might be quite a bit harder.\r\n\r\nFiling on GHC Trac as it's the parser that needs changing I believe.","type_of_failure":"OtherFailure","blocking":[]} -->
issue