[Haddock] Data family instance documentation

David Waern david.waern at gmail.com
Sun Oct 17 06:44:25 EDT 2010

2010/9/29 C Rodrigues <red5_2 at hotmail.com>:
> Hi,
> I have started adding data family instance support to haddock, since I have been wanting this feature.  So far, I've managed to show data instance definitions in HTML.  Until I implement the visibility computation, instances won't always show up when they should.  Since data instances are exported like class instances, but have bodies like data declarations, my plan is to show:
> * Family instances are, like type classes, always exported.  They are listed as instances of their family.

OK. Do you plan to list the instances like class instances are
currently listed under classes?

> * Family constructors are visible if they are exported.  If any constructors of a data family instance are visible, the instance is shown like a data definition in its home module.

Could you give an example of how this would look?

> The GHC API is rather formidable.  I would like help with understanding two things.  What data structures in the API can I access to find type family instances and constructors?  How does the current Haddock code connect data constructors with data types (classDataSubs?).

Yes, classDataSubs. But the data constructors are also reachable from
the data type declarations directly.

For the GHC API and type families I don't know. Perhaps you have found
out already? Otherwise just browse the code.

Sorry for getting to this so late.


More information about the Haddock mailing list