Reputation: 158
I'm just beginning with Haskell and I can't understand one thing - why doesn't something like this work?
fun f = f * f
main =
do
foo <- getLine
bar <- getLine
print (fun 4)
I keep receiving " parse error on input `print' " from ghc. But what's even more mysterious to me is that it works after removing foo <- getLine and bar <- getLine. Any ideas?
Upvotes: 1
Views: 376
Reputation: 64740
This means you are mixing tabs and spaces. Notice white space is important to parsing Haskell. Your print
line is probably too far indented (or not indented far enough). Replace all your tabs!
EDIT: Notice a copy/paste of the code you posted will only use spaces and works fine.
Upvotes: 10