2
votes

I've been following a Learn Haskell in 10 Minutes tutorial. Everything was going well until I reached this line:

do { n <- readLn ; print (n^2) }

It won't execute in ghci, and in Leksah I get the following error.

Parse error: naked expression at top level

I've tried updating cabal and installing foo, but the problem continues.

Your help would be greatly appreciated.

I'm using Ubuntu 11.10.

1
are you giving it the n value it needs?Dhaivat Pandya
I had no idea what the tutorial meant by "reading." Now I know. It wanted my input! Thank you for the help. I'm back on track now.subtlearray
@SubtleArray: If an answer helped you, you should click the tick mark to accept it :)ehird
To make it work in Leksah, make it main = do { ... }.hammar
@hammar Awesome. I'll try that now. Thank you.subtlearray

1 Answers

10
votes

It's not freezing, it's waiting for input. Try typing a number and pressing Enter.