[Haskell-beginners] factorial question

KMandPJLynch kmandpjlynch at verizon.net
Fri Aug 31 18:23:24 CEST 2012


Good afternoon,

I'm going thru Graham Hutton's book "Programming in Haskell" [and am viewing the associated online lectures by Erik Meijer and Graham].
I find both to be excellent.
My problem is with the following statements:

factorial'      :: Int -> Int
factorial'  0    = 1
factorial' (n+1) = (n+1)*factorial' n

When I load this into GHC I get the following error:

pihch01.hs:128:13: Parse error in pattern: n + 1

I'd appreciate any advice.

Good day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120831/f6939097/attachment.htm>


More information about the Beginners mailing list