deriving keyword in Haskell
presents a small problem for Haddock. Lacking a full type
system, Haddock has to figure out what the shape of the derived
instance is. There is currently a partial implementation of
this, but for some data types Haddock can't determine the shape
of the derived instance, and you see something like
“???” in the documentation.
One workaround for this is to use CPP (Section 2.1, “Using literate or pre-processed source”) to give Haddock explicit instance headers. Here is an example from the OpenGL library:
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
As a rule of thumb, try
and if that doesn't work then use the above workaround.