haskell / haddock

Haskell Documentation Tool

Home Page:www.haskell.org/haddock/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Private constructor with `NoFieldSelectors` hides all the fields

ruifengx opened this issue · comments

Consider the following code:

{-# LANGUAGE NoFieldSelectors #-}
module Test (Point (x, y)) where
data Point = Point { x :: Double, y :: Double }

Haddock does not list the fields x and y in the generated documentation, presumably because the field selector functions are not generated (due to NoFieldSelectors). However, the fields can still be used via sections like (.x), (.y) :: Point -> Double or p.x, p.y :: Double where p :: Point (with OverloadedRecordDot). It's desirable to have Haddock list these fields in the documentation to make them more accessible to the user.

I think a temporary workaround would be to generate the documentation as if the constructor were exported. For the long term, I think it suffice to have a special decoration on the constructor to indicate it is in fact not exported.

Hi, thank you for this ticket, but Haddock now lives full-time in the GHC repository!
Read more at https://discourse.haskell.org/t/haddock-now-lives-in-the-ghc-repository/9576.

Let me know if you feel it is still needed, and I'll migrate it. :)