[Haskell] Creating a factorial function in GHC

Angus Comber anguscomber at gmail.com
Wed May 9 10:24:24 CEST 2012


I am trying to create a factorial function in GHC.  I am following the
online learnyouahaskell.com book (specifically types-and-typeclasses
page).

Bear in mind this is my day 1 of learning Haskell.

The book suggests:

factorial :: Integer -> Integer
factorial n = product [1..n]

But if I enter first line then press <Enter> I see:
<interactive>:1:1 Not in scope: 'factorial'

What am I doing wrong?

Angus



More information about the Haskell mailing list