约从http://www.seas.upenn.edu/~cis194/lectures/02-lists.html咖喱/ uncurry(schönfinkel/unschönfinkel)的定义,如何理解咖喱的函数定义/ uncurry
schönfinkel :: ((a,b) -> c) -> a -> b -> c
schönfinkel f x y = f (x,y)
unschönfinkel :: (a -> b -> c) -> (a,b) -> c
unschönfinkel f (x,y) = f x y
但我觉得上面这些函数的定义应该是:
schönfinkel :: ((a,b) -> c) -> a -> b -> c
schönfinkel f (x,y) = f x y
-- schönfinkel(curry) converts an uncurried function
-- (f (x,y), its type signature is (a,b) -> c)
-- to a curried function
-- (f x y, its type signature is a -> b -> c)
unschönfinkel :: (a -> b -> c) -> (a,b) -> c
unschönfinkel f x y = f (x,y)
-- unschönfinkel(uncurry) converts a curried function
-- (f x y , its type signature is a -> b -> c)
-- to an uncurried function
-- (f (x,y), its type signature is (a,b) -> c)
请有人给我一个简单的解释?
在'schönfinkel'中,如果'f'具有类型'(a,b) - > c'then然后你不能像你所做的那样将它应用于2个参数。你在一个元组上匹配模式,但是类型表示还有两个参数,它们都不是元组。 – user2407038 2015-03-03 05:40:56