caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Florent Ouchet <florent.ouchet@imag.fr>
To: Alexander Bernauer <bernauer@inf.ethz.ch>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] type of high order functions
Date: Wed, 15 Dec 2010 09:31:27 +0100	[thread overview]
Message-ID: <4D087CDF.7000004@imag.fr> (raw)
In-Reply-To: <20101214203043.GA9093@apus.ethz.ch>

Alexander Bernauer a écrit :
> 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;
 - after the type inference algorithm is executed.

In your first case, the type inference algorithm gave "f : (int -> 
string) -> int -> string)" after it considered "x" but before it starts 
considering "y" (that step will then fail) and a long time before it 
considers your explicit type constraint.

In your second case, you splitted the statements in 2 blocks, the type 
inference algorithm is called twice (once per block), and this time your 
type constraint was considered before x and y are effectively typed.

-- 
Florent Ouchet
PhD Student
CIS/VDS Team - TIMA Laboratory



  reply	other threads:[~2010-12-15  8:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 20:30 Alexander Bernauer
2010-12-15  8:31 ` Florent Ouchet [this message]
2010-12-16  8:32   ` [Caml-list] " Alexander Bernauer
2010-12-16  8:46     ` bluestorm
2010-12-15  8:32 ` Alain Frisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D087CDF.7000004@imag.fr \
    --to=florent.ouchet@imag.fr \
    --cc=bernauer@inf.ethz.ch \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).