1
votes

Suppose that the Haskell or lambda calculus presents the following function types:

A -> B -> C

(A -> B) -> C

How are these two different?

2
The first is equivalent to A -> (B -> C). Was that your question?n. 1.8e9-where's-my-share m.

2 Answers

4
votes

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".

0
votes

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