Skip to content
  • Alec Theriault's avatar
    Support constructor Haddocks in more places · e20046a0
    Alec Theriault authored and Ben Gamari's avatar Ben Gamari committed
    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).
    
    Reviewers: bgamari, alanz
    
    Subscribers: rwbarton, thomie, mpickering, carter
    
    Differential Revision: https://phabricator.haskell.org/D4292
    e20046a0