我认为您的代码缩进不足。尝试这个:
main = do line <- getLine let line' = reverse line putStrLn $ "You said " ++ line' ++ " backwards!" putStrLn $ "Yes, you really said " ++ line ++ " backwards!"
具体来说,do
应该紧跟在您之后的行与紧随其后的行缩进line <- getLine
。
我认为您的代码缩进不足。尝试这个:
main = do line <- getLine let line' = reverse line putStrLn $ "You said " ++ line' ++ " backwards!" putStrLn $ "Yes, you really said " ++ line ++ " backwards!"
具体来说,do
应该紧跟在您之后的行与紧随其后的行缩进line <- getLine
。