Skip to content

Support prefix Haddock comments on unnamed constructor fields

Proposal

GHC supports postfix Haddock comments on unnamed constructor fields:

data Foo
  = Foo
      Int  -- ^ Field 1
      Bool -- ^ Field 2

For consistency, we should also support prefix Haddock comments:

data Foo
  = Foo
      -- | Field 1
      Int
      -- | Field 2
      Bool

Currently GHC fails on the example above:

/tmp/z.hs:4:7: error: parse error on input ‘Int’
  |
4 |       Int
  |       ^^^

NB: support for prefix Haddocks has been added in e20046a0.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information