Reputation: 111
Suppose that the Haskell or lambda calculus presents the following function types:
A -> B -> C
(A -> B) -> C
How are these two different?
Upvotes: 1
Views: 593
Reputation: 74344
The first is a function from A
to a (a function from B
to C
). The second is a function from (functions from A
to B
) to C
. The first "takes two arguments" the second "takes one argument". The first is a normal function, the second is a "higher order function".
Upvotes: 4
Reputation: 16253
Here are two example functions with your types that will help you figure out how these are different:
valatzero :: Num a => (a -> t) -> t
valatzero f = f 0
plus :: Num a => a -> a -> a
plus x y = x + y
Upvotes: 0