Cannot parse Haddock comment on GADT argument with strictness annotation
Summary
Originally reported in the Haddock issue tracker: https://github.com/haskell/haddock/issues/1053. The issue is that GHC won't parse a Haddock comment on a GADT constructor argument that already has a strictness annotation.
Steps to reproduce
$ cat GADT.hs
data F a where
X ::
!Int -- ^ comment
-> F Int
$ ghc -haddock GADT.hs
[1 of 1] Compiling Main ( GADT.hs, GADT.o )
GADT.hs:3:7: error:
• Unexpected strictness annotation: !Int
strictness annotation cannot appear nested inside a type
• In the type ‘!Int " comment"’
In the definition of data constructor ‘X’
In the data declaration for ‘F’
|
3 | !Int -- ^ comment
| ^^^^
Expected behavior
The input file GADT.hs
should parse just fine!
Environment
GHC versions where this reproduces: 8.9.20190224, 8.6.4.
8.4.4, 8.2.2, and 8.0.2 also won't parse, but with different error messages.