
Hi! I'm new to Haskell. Following someone's notes, I was doing this "doubleMe x = x + x". I did this two days ago and it worked. But I try to do it today, I got an error "parse error on input '=' ", This is rather inconsistent and should not happen in a computer compiler (i.e. day one works, day second not work) This comes up in both cases: loading a .hs file and interactively. Can anyone tell me what I did wrong? This happened to both my Win XP and my Ubuntu 10.10 PC. Thank you very much. Cheers. Simon.

On Tue, Mar 08, 2011 at 12:40:23PM +0800, Simon Sin wrote:
Hi! I'm new to Haskell. Following someone's notes, I was doing this "doubleMe x = x + x". I did this two days ago and it worked. But I try to do it today, I got an error "parse error on input '=' ",
If you put doubleMe x = x + x by itself in a .hs file and load it into ghci, it should work just fine. On the other hand, you cannot simply type it at the ghci prompt; you will get a parse error like the one you mentioned. ghci only allows you to enter expressions, not declarations. -Brent

fine. On the other hand, you cannot simply type it at the ghci prompt; you will get a parse error like the one you mentioned. ghci only allows you to enter expressions, not declarations.
Which in practise (for a total beginner not familiar with haskell) means typing `let doubleMe x = x + x` instead.
participants (3)
-
Brent Yorgey
-
Simon Sin
-
Tim Watson