caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi VANICAT <vanicat@labri.u-bordeaux.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Type inference problem
Date: 28 Jun 2001 17:40:20 +0200	[thread overview]
Message-ID: <87ithg1ul7.dlv@wanadoo.fr> (raw)
In-Reply-To: <20010628172348.A24964@boblycat.com>

Vasilij Karpow <malc@boblycat.com> writes:

> Can anyone explain why O'Caml specializes the following:
> 
> let simple ?fn list =
>   let fn = match fn with
>   | Some fn -> fn
>   | None -> fun t -> t in
>   let rec print = function
>     | [] -> ()
>     | x :: xs -> print_endline (fn x); print xs
>   in
>   print list
> 
> let _ =
>   simple ["1"];
>   simple ~fn:(fun i -> string_of_int i) [1]
> 
> 
> to: val simple : ?fn:(string -> string) -> string list -> unit

it's easy. If the value was polymorphic, you would be authorized to
write :

simple [1; 2; 3; 4; 5]

which is unsound.


-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-06-28 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-28 15:23 Vasilij Karpow
2001-06-28 15:40 ` Remi VANICAT [this message]
2001-06-28 19:08 ` Nils Goesche
2001-06-29  2:41 ` Jacques Garrigue
2005-11-01  7:58 Jonathan Roewen
2005-11-01  8:19 ` Jonathan Roewen
2005-11-01  8:50   ` skaller
2005-11-01  8:34 ` skaller
2005-11-01 16:21 ` Brian Hurt

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=87ithg1ul7.dlv@wanadoo.fr \
    --to=vanicat@labri.u-bordeaux.fr \
    --cc=caml-list@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).