Hello,
I encountered a strange typing problem and reduced it to the following
code example:
====[t.ml]====
let mk_env () = None
let list_of_string (s: string) = [s]
let apply : 'a -> 'a option -> string list -> 'a * string list =
fun acc env l -> (acc, ["hello"])
let f =
let tmpl = ["coucou"] in
fun ?(env=mk_env()) ->
fun ~x ->
fun () -> apply () env tmpl
let g =
let tmpl = list_of_string "coucou" in
fun ?(env=mk_env()) ->
fun ~x ->
fun () -> apply () env tmpl
====
Note that f and g only differ on the way tmpl is defined.
When I compile this file with ocaml 4.02.1, I get the following error:
File "t.ml", line 14, characters 3-119:
Error: The type of this expression,
?env:unit option -> x:'_a -> unit -> unit * string list,
contains type variables that cannot be generalized
Am I missing something or should I file a bug report ?
Regards,
Maxence
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs