Browse thread
type of high order functions
-
Alexander Bernauer
-
Florent Ouchet
- Alexander Bernauer
- Alain Frisch
-
Florent Ouchet
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alexander Bernauer <bernauer@i...> |
| Subject: | Re: [Caml-list] type of high order functions |
On Wed, Dec 15, 2010 at 09:31:27AM +0100, Florent Ouchet wrote: > >Why is it that the first example does not compile while the later ones do? > Because type constraints are considered: > - only for type restriction, not for generalization; Hmm, I thought specifying a type is always a restriction compared to saying nothing at all and thus allowing everything. > - after the type inference algorithm is executed. If I don't specify a type, what's the inferred type of f? If I restrict f to the exact same type it should do no harm. At least, that is what I expected. So, I do understand your explanations but I don't understand the reasons for them. I will go and consult the literature on the ML typing system. Thank you all for your replies. Greetings Alex