[Haddock] Documentation for data family instances
David Waern
david.waern at gmail.com
Sun Nov 14 17:22:39 EST 2010
2010/10/19 C Rodrigues <red5_2 at hotmail.com>:
>
> Replying to David Waern:
>
>...
>
> 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?
>
>
>
Thanks for the example. You're right that it makes sense to make the
instances ExportItems.
But I still think the instances should exist in short-form in the
expItemInstances of the family ExportItem. Do you agree?
Sorry for the late reply!
David
More information about the Haddock
mailing list