简单功能中的错误代码

时间:2016-04-18 15:09:10

标签: haskell

verdopple :: Integer -> Integer
verdopple x = x + x

当我尝试将前面的代码运行到GHCi中时,我收到以下错误:

No instance for (Show (Integer -> Integer))
    (maybe you haven't applied enough arguments to a function?) arising from a sue of 'print'
    In a stmt on an interactice GHCi command: print it

谁能告诉我有什么问题? 提前谢谢!

1 个答案:

答案 0 :(得分:3)

您收到此错误,因为在ghci提示符下,您执行了类似的操作:

*Main> verdopple

这是要求ghci打印出你的功能,它的错误信息告诉你“我无法打印功能”。

尝试询问verdopple 5:type verdopple