[Haddock] Documentation for data family instances

C Rodrigues red5_2 at hotmail.com
Mon Oct 18 22:11:26 EDT 2010

Replying to David Waern:

On closer inspection, it's probably not a bug.  It's just impossible to explicitly export a datafamily's data constructor without also exporting the data family.  Haddock dutifully displays theunwanted type family declaration, even though I only wanted to export a data constructor.

Here's an example of what I would like in Haddock output.  In short, I would like to see datafamilies documented like type classes, and data family instances documented like data/newtypeconstructors.

> data family T :: * -> *
>  This description fits the data type to a T.  Since this is a family-friendly mailing list, the>  details of T Bag are not exported and you can only see that an instance exists.
>  Instances
>    T Time
>    T Shirt>    T Bag
> data instance T Shirt
>  Constructors
>    Generous Size
>    Fitted Size
> buy :: IO (T Shirt)
> newtype instance T Time
>  Constructors
>    TTime Time
> brew :: T Time -> IO ()

To me, data instances are a lot like regular data types: you'd like to put them in a specific placein the documentation.  This makes them behave quite differently from class instances, whichdon't have first-class status in Haddock but can only be attached to other entities.  Yourquestions made me realize that my patch doesn't do what I want when there's a module exportlist.

Given that, I think data instances should be ExportItems.  You mentioned putting them inexpItemInstances, but wouldn't that force data instances to appear together with the data family?


More information about the Haddock mailing list