haddock icon indicating copy to clipboard operation
haddock copied to clipboard

Haddock doesn't include selectors from record pattern synonyms

Open sjakobi opened this issue 6 years ago • 3 comments

The module

{-# language PatternSynonyms #-}
module Lib where

pattern P{x, y} = (x, y)

has the following exports:

λ :browse Lib
pattern P :: a -> b -> (a, b)
x :: (a, b) -> a
y :: (a, b) -> b

But Haddock doesn't show x and y:

image

sjakobi avatar Nov 18 '18 17:11 sjakobi

Oops. Seems like this is already fixed in the wip/hi-haddock tree: :)

image

What this doesn't reveal though, is that x and y can be used in the pattern:

λ P {x = 1, y = 2}
(1,2)

sjakobi avatar Nov 18 '18 17:11 sjakobi

Even ghci's :browse does a pretty terrible job of presenting the information. We need some nice output presentation that

  • supports record selectors, GADT and not GADT
  • supports pattern synonym selectors
  • supports partial exporting of selectors

harpocrates avatar Nov 29 '18 20:11 harpocrates

Some updates:

  • When the pattern synonym is exported bundled with its parent type, its field selectors are completely missing from Haddock. They're only visible if exported separately.
  • This is still around, and affects https://hackage.haskell.org/package/snumber-0.1.0.0/docs/Data-SNumber.html, where the exported unSNumber is missing.

awpr avatar Oct 24 '21 19:10 awpr