class ??? with Haddock

Wolfgang Jeltsch wolfgang at jeltsch.net
Wed Dec 31 18:32:27 EST 2003


Am Mittwoch, 31. Dezember 2003 17:48 schrieb Sven Panne:
> 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
> ------------------------------------------------------------------------

Hello again,

does Hugs understand C preprocessor macros?  If not, your approach would be 
bad for me since I try to stay Hugs-compatible.

> Cheers,
>     S.

Happy New Year!
Wolfgang



More information about the Haskell mailing list