[Haskell-beginners] haddock parse error

Christopher Howard christopher.howard at frigidcode.com
Tue Mar 19 07:41:23 CET 2013

Hi. I tried to run haddock on a file with this content:

  The 'summation' function provides the same function as summation or sigma
  notation. The first argument the starting index number. The second
  is the ending index number. The third argument is a function representing
  the formula for each term.
summation :: (Eq a, Num a1, Num a) => a -> a -> (a -> a1) -> a1
summation i n f | i == n = f i
                | otherwise = f i + summation (i + 1) n f


And I get

$ haddock summation.hs

summation.hs:7:1: parse error on input `summation'

What is wrong with it? (The code runs fine with GHC.)

$ haddock --version
Haddock version 2.10.0, (c) Simon Marlow 2006
Ported to use the GHC API by David Waern 2006-2008

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130318/1270e6b3/attachment.pgp>

More information about the Beginners mailing list