【发布时间】:2011-03-07 06:15:38
【问题描述】:
我是 Haskell 的新手。
我的带有GHCi 的 Haskell 脚本,
Prelude> let a = putStrLn getLine
会出现这样的错误。
<interactive>:1:17:
Couldn't match expected type `String'
against inferred type `IO String'
In the first argument of `putStrLn', namely `getLine'
In the expression: putStrLn getLine
In the definition of `a': a = putStrLn getLine
Prelude>
为什么它不起作用,我如何打印来自 stdin 的输入?
【问题讨论】: