Haskell: parse error on input 'putStrLn'

后端 未结 1 941
予麋鹿
予麋鹿 2021-01-18 20:53

I just wrote my first Haskell program, but there is an error that I cannot understand. I think it is right because I just wrote it like the example from a book. Could anyone

相关标签:
1条回答
  • 2021-01-18 21:14

    Though it's impossible to tell from your posted code because SO converts tabs to spaces at least some of the time, the problem is likely that you input a literal tab character before putStrLn instead of four spaces as you did for the other two lines in your do block, or vice versa.

    All of the statements in a do block must start with the exact same whitespace, and not just appear to line up visually. If you're using a text editor that can display literal tabs in a special way, set it up to do so; it will save you some headaches.

    0 讨论(0)
提交回复
热议问题