如果 haskell 中的每个函数都被柯里化了,那我怎么不能创建部分对呢?
If every function in haskell is curried then how come i can't create partial pairs?
这里是菜鸟。我不确定是否应该柯里化每个函数(但这就是我的感觉)。
如果确实是这样那怎么会
(,) 1
抛出错误?它不应该 return 一个函数,当应用到另一个值时给出一个元组吗?
how come (,) 1
throws an error? Shouldn't it return a function [...]?
这两个都可能是真的。
λ> let f = (,) 1 in f 2
(1,2)
但由于函数没有 Show
实例,只需键入 (,) 1
会 引发错误:
λ> (,) 1
<interactive>:4:1: error:
• No instance for (Show (b0 -> (Integer, b0)))
arising from a use of ‘print’
(maybe you haven't applied a function to enough arguments?)
• In a stmt of an interactive GHCi command: print it
这里是菜鸟。我不确定是否应该柯里化每个函数(但这就是我的感觉)。
如果确实是这样那怎么会
(,) 1
抛出错误?它不应该 return 一个函数,当应用到另一个值时给出一个元组吗?
how come
(,) 1
throws an error? Shouldn't it return a function [...]?
这两个都可能是真的。
λ> let f = (,) 1 in f 2
(1,2)
但由于函数没有 Show
实例,只需键入 (,) 1
会 引发错误:
λ> (,) 1
<interactive>:4:1: error:
• No instance for (Show (b0 -> (Integer, b0)))
arising from a use of ‘print’
(maybe you haven't applied a function to enough arguments?)
• In a stmt of an interactive GHCi command: print it