Reputation: 1283
This is an exercise from the standard ML tutorial seen here: http://homepages.inf.ed.ac.uk/stg/NOTES/node42.html
I am not taking a class so there is no cheating going on here. But I can't figure out how to do this. Can someone help?
The function fn x => fn y => x
has type 'a -> ('b -> 'a)
. Without giving an explicit type constraint, define a function with type 'a -> ('a -> 'a)
Upvotes: 0
Views: 189
Reputation: 36118
Hint 1: You have to find an expression that has 2 or more subexpressions but requires them to have the same type.
Hint 2: Lists or conditionals are good contenders.
Hint 3: Of course, the subexpressions you put in there are the two arguments.
Hint 4: You don't need to use the result of this expression.
Upvotes: 2