a very simple question from a student of Haskell. I work through Another Haskell Tutorial , and I follow a simple syntactical practice. The code below: When I copy and paste it (from pdf) and then indent it, it works fine, but when I enter it into the editor (in my case Notepad ++), it gives the following error:
Guess.hs:8:9: parse error on input ยดhSetBufferingยด
I made sure that I did not mix tabs and spaces (4 spaces), and I did not find typos in the book. I am sure this is a very simple mistake, so thanks for any input.
Nebelhom
Here is the code:
module Main where import IO import Random main = do hSetBuffering stdin LineBuffering num <- randomRIO (1::Int, 100) putStrLn "I'm thinking of a number between 1 and 100" doGuessing num doGuessing num = do putStrLn "Enter your guess:" guess <- getLine let guessNum = read guess if guessNum < num then do putStrLn "Too low!" doGuessing num else if read guess > num then do putStrLn "Too high!" doGuessing num else do putStrLn "You Win!"
source share