Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
type of high order functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-12-16 (08:32)
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

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.