In this article, this function
let adderGenerator numberToAdd = (+) numberToAdd
has this type signature
int -> (int -> int)
However, when I create this function, the inferred type signature is
int -> int -> int
- Are these type signatures different?
- If not, how can I annotate my
adderGenerator
so that it has the first type signature?
Edit 1
This is the best I could come up with so far:
type Generator = int -> (int -> int)
let adderGenerator: Generator = (+)
I don't like how it makes adderGenerator
adopt a point-free style.
Edit 2
This seems to work:
let adderGenerator numberToAdd : (int -> int) = (+) numberToAdd