Support constructor Haddocks in more places
ClosedPublic

Authored by harpocrates on Jan 7 2018, 2:27 PM.

Details

Summary

This adds support for adding Haddocks on individual non-record fields
of regular (and GADT) constructors. The following now parses just fine
with -haddock enabled:

data Foo

= Baz             -- ^ doc on the `Baz` constructor
    Int           -- ^ doc on the `Int` field of `Baz`
    String        -- ^ doc on the `String` field of `Baz`

| Int             -- ^ doc on the `Int` field of the `:*` constructor
    :*            -- ^ doc on the `:*` constructor
  String          -- ^ doc on the `String` field of the `:*` constructor

| Boa             -- ^ doc on the `Boa` record constructor
    { y :: () }

The change is backwards compatible: if there is only one doc and it occurs
on the last field, it is lifted to apply to the whole constructor (as
before).

harpocrates created this revision.Jan 7 2018, 2:27 PM

@bgamari Ping? This is just https://phabricator.haskell.org/D4094 rebased, with all the tests passing.

@bgamari Ping? This is just https://phabricator.haskell.org/D4094 rebased, with all the tests passing.

Trying to merge again.

This revision was automatically updated to reflect the committed changes.

At long last this is merged. Thanks @harpocrates and sorry for the long delay!