haskell / haddock

Haskell Documentation Tool
www.haskell.org/haddock/
BSD 2-Clause "Simplified" License
361 stars 241 forks source link

Show documentation attached to constructors of associated types #1614

Closed tdammers closed 4 months ago

tdammers commented 12 months ago

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.

rampion commented 10 months ago

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

Kleidukos commented 4 months ago

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