标准输出,我有这样一个简单的函数:输出整型在Haskell
nth :: Integer -> Integer
我尝试打印它的结果如下:产生
main = do
n <- getLine
result <- nth (read n :: Integer)
print result
以下错误:
Couldn't match expected type `IO t0' with actual type `Integer'
In the return type of a call of `nth'
In a stmt of a 'do' expression:
result <- nth (read n :: Integer)
也尝试与putStrLn
和许多其他组合,没有运气。
我想不出来,我需要一些帮助,因为我不完全了解东西如何在这些IO
s工作。
单行:'main = print。 nth。阅读=“getLine' – JJJ 2012-04-22 06:40:38