[Haskell-cafe] Re: Haddock seems to generate wrong types in newtype deriving

Sven Panne Sven.Panne at aedion.de
Sat May 6 08:22:30 EDT 2006


Am Montag, 24. April 2006 14:36 schrieb Brian Hulley:
> Thanks - I'm glad it's not just me!
> In the meantime, I found a better workaround (since the type decl using a
> class name is not legal Haskell) is just to use -cpp to preprocess for both
> ghc and haddock so that haddock sees explicitly defined dummy instances
> instead of a newtype deriving clause, then perfect results are obtained...

This workaround is actually "state-of-the-art"! :-P  If you look at the 
hierarchical libraries, there is often code like:

   data VertexArrayDescriptor a =
      VertexArrayDescriptor !NumComponents !DataType !Stride !(Ptr a)
   #ifdef __HADDOCK__
   -- Help Haddock a bit, because it doesn't do any instance inference.
   instance Eq (VertexArrayDescriptor a)
   instance Ord (VertexArrayDescriptor a)
   instance Show (VertexArrayDescriptor a)
   #else
      deriving ( Eq, Ord, Show )
   #endif

Cheers,
   S.


More information about the Haskell-Cafe mailing list