haddock icon indicating copy to clipboard operation
haddock copied to clipboard

Show documentation attached to constructors of associated types

Open tdammers opened this issue 2 years ago • 1 comments

It looks like Haddock does not see documentation attached to constructors of associated type instances, whereas it does see documentation attached to constructors of regular types.

Example:

{-# LANGUAGE TypeFamilies #-}
class Foo a where data DF a

instance Foo Int where
  newtype DF Int =
    -- | Make DF
    MkDF Int

newtype Ty =
    -- | Make Ty
    MkTy Int
*Main> :doc MkTy
MkTy :: Int -> Ty     -- Data constructor defined at DF.hs:10:5
-- | Make Ty
*Main> :doc MkDF
<has no documentation>

I would expect :doc MkDF to cough up the line -- | Make DF, but this is not the case.

Trying to extract the documentation via Template Haskell's getDoc function gives similar results: the documentation attached to MkTy can be found just fine, but getDoc 'MkDF comes back empty.

tdammers avatar Oct 10 '23 13:10 tdammers

Adding insult to injury, you get warnings about the missing documentation for the constructors.

rampion avatar Nov 18 '23 23:11 rampion

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. :)

Kleidukos avatar May 18 '24 15:05 Kleidukos