class ??? with Haddock

Sven Panne Sven.Panne at aedion.de
Wed Dec 31 17:48:50 EST 2003


Wolfgang Jeltsch wrote:
> I have a datatype
>     Relation element1 element2
> which derives an Eq instance.  In the Haddock-generated documentation the 
> instances section of Relation says
>     (Ord element1, Ord element2, ??? element1 element2) => [...].
> Why does Haddock generate this mysterious
>     ??? element1 element2
> context?

Haddock doesn't do any real type inference, it only handles some "easy"
cases for deriving clauses. If you want nice documentation, you have to
fake things a little bit (cut-n-paste from my OpenGL stuff):

------------------------------------------------------------------------
data GLmatrix a = GLmatrix MatrixOrder (ForeignPtr a)
#ifdef __HADDOCK__
-- Help Haddock a bit, because it doesn't do any instance inference.
instance Eq (GLmatrix a)
instance Ord (GLmatrix a)
instance Show (GLmatrix a)
#else
    deriving ( Eq, Ord, Show )
#endif
------------------------------------------------------------------------

Cheers,
    S.



More information about the Haskell mailing list