【发布时间】:2017-12-18 19:01:28
【问题描述】:
我知道什么是缩进错误,但我不知道为什么我会在这里收到这个错误,而每一个都对齐,试图解决它 2 小时。
Account.hs:40:25: error:
parse error (possibly incorrect indentation or mismatched brackets)
|
40 | let amount = readLn :: IO Int
| ^
Failed, 0 modules loaded.
main = do
putStrLn $ "Press one to create a new account"
let g = getLine
enteredValue = read g :: Int
if g == 1
then do putStrLn $ "Enter your name "
let name = getLine
putStrLn $ "Enter the initial amount"
let amount = readLn :: IO Int
value = Account (name,1,amount) Saving
show value
else do putStrLn $ "Nothing"
我也试过这个版本,但这也给了incorrect indentation or mismatched brackets:
main = do
putStrLn $ "Press one to create a new account"
let g = getLine
enteredValue = read g :: Int
if g == 1
then do putStrLn $ "Enter your name "
let name = getLine
putStrLn $ "Enter the initial amount"
amount = readLn :: IO Int
value = Account (name,1,amount) Saving
show value
else do putStrLn $ "Nothing"
【问题讨论】:
-
顺便说一句。请不要使用图片来显示基于“文本”的信息 - 只需复制粘贴错误消息并像添加源代码一样添加它。搜索引擎更容易为您的内容编制索引,并使您的问题自成一体,如果您的图片的托管服务关闭,则无法回答/理解问题。
标签: haskell