I’m going through the book Natural Language Processing for Working Programmers. The book uses Haskell, which I don’t have much experience with. The code below throws an error in GHCI
:{
do
l <- [0..9]
ps <- (\x -> [x-1, x+2]) l
return ps
:}
This is the error message returned
The last statement in a 'do' construct must be an expression
All answers I’ve come across seem to suggest it is an indentation error, but as far as I can tell the indentation seems correct. Any ideas what the problem could be?
I typed your code into ghci 7.0.3 and did not get an error.
Edit: When I use ghci 6.12.1 as packaged in Ubuntu 10.04, I get the same error as you.