Browse thread
[Caml-list] Type inference problem
- Vasilij Karpow
[
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: | Vasilij Karpow <malc@b...> |
| Subject: | [Caml-list] Type inference problem |
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
Thanks in advance.
P.S. A bit offtopic. I suspect this mailing list is filled with
skilled mathematicians (and just intelligent people), and since
nobody i know was able to solve my problem, here it is:
http://algol.prosalg.no/~malc/moo.ps [.dvi|.pdf|.tex]
--
mailto:malc@pulsesoft.com
-------------------
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