On Wed, 9 May 2012, Angus Comber wrote:
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.
Then [email protected] might be a better place to ask, since [email protected] is for announcements.
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?
The code you entered is intended to be the content of a text file that can be loaded into GHCi or Hugs. If you want to write it immediately into GHCi you may write:
Prelude> let factorial :: Integer -> Integer; factorial n = product [1..n] _______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
