On Sat, 30 Aug 2008 14:03:10 +0100, Richard Jones wrote: > > > # let x = ref `X;; > > val x : _[> `X ] ref = {contents = `X} > > OK ... so how to get rid of the error? Even supplying a full type for > get_domains in the implementation doesn't get rid of it. > > Here's the code if anyone wishes to try: > > http://www.annexia.org/tmp/libvirt.mli > http://www.annexia.org/tmp/libvirt.ml > > $ ocamlc -c libvirt.mli > $ ocamlc -c libvirt.ml
Here is the crux of your problem let f = let a = ref 0 in fun (x : [> `R ]) -> x;; If you hoist [let have_list_all_domains = ref None] outside [let get_domains], then it works fine. The type checker could certainly be slightly improved [1] there but I do not know how difficult it is. C. --- [1] And maybe also the compiler: a rough check seem to indicate that hiding the variable in the definition of f is slightly slower. _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs