相关疑难解决方法(0)

为什么函数没有Show实例?

这是一个快速的概念性问题,我目前正在努力学习和更好地理解Haskell.

我知道Show函数用于将值转换为字符串,但为什么函数类型不能与show一起使用?

Prelude> (\x -> x*3)

<interactive>:7:1:
    No instance for (Show (a0 -> a0))
      arising from a use of `print'
    Possible fix: add an instance declaration for (Show (a0 -> a0))
    In a stmt of an interactive GHCi command: print it
Prelude>
Run Code Online (Sandbox Code Playgroud)

haskell

7
推荐指数
2
解决办法
2123
查看次数

标签 统计

haskell ×1