[Haskell-cafe] Haddock Parse Errors

Matthew Bromberg mattcbro at earthlink.net
Fri Oct 6 13:30:20 EDT 2006


I am trying to use Haddock for the first time on windows for a 
reasonably large project.
I must be completely clueless because I seem to generate a lot of parse 
errors that have no reasonable explanation.
In some cases it seems like Haddock is white space sensitive requiring 
the same indentation as my source code.  If so, this is not clearly 
documented.

However consider this example:  in my matrix library I have this code 
snippet:


...

-- | class instance Rmatrix, real only matrices
instance Matrix Rmatrix where
   
    -- | tells us if its a submatrix (better to use pattern matching)
    issub x = case x of
        Rindx n -> False
        Rsubindx n -> True

...

This generates a parse error on the line
-- | class instance Rmatrix, real only matrices
at the first s in class.  Removing the | from the comment generates a parse
error on the instance declaration even though there are no haddock 
comments that apply to it!

The code prior to this looks something like...
    -- | copy one matrix into another
    copy :: m -> m -> m
    copy a b = mio $ do
        ka <- pushsub a
...
and is part of the class declaration itself.

I'm not sure why an auto-documentation tool shouldn't be a bit more 
forgiving vis a vis it's syntax.  Maybe flag errors as warnings but keep 
on going.
I run haddock from the command prompt via the command
 haddock.exe -o docs -v -h matrix.hs


More information about the Haskell-Cafe mailing list