Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] 'a & string unification issue

1 view
Skip to first unread message

Alessandro Baretta

unread,
Aug 22, 2006, 1:09:02 PM8/22/06
to Ocaml
Hi guys. I haven't been around for a while. I hope everything's been well for
everybody these past six months or so.

I'm back to my usual tuareg-mode session, and I'm back to my usual typing
trouble. Does the following error message, coming from a fresh installation of
ocaml 3.09.2, make any sense.

Values do not match:
val init :
[< `Odbc_driver of
[< `Default
| `Options of
[< `DSN of string ] * [< `User of string ] *
[< `Password of string ] ]
| `Pgsql_driver of
[< `Default
| `Options of
[< `Client_encoding of string

(* The problem seems to be here: shouldn't 'x & string unify trivially *)
(* for any type variable 'x? *)
| `DB of 'a & string
| `Debug_log of 'b & string
| `Debug_options of 'c & string
| `Host of 'd & string
| `Hostaddr of 'e & string
| `Password of 'f & string
| `Port of 'g & int
| `SSL of 'h & string
| `User of 'i & string ]
list
| `String of string
> `Options ] ] ->
[> `Odbc_driver of Odbc_driver.pipeline
| `Pgsql_driver of Pgsql_driver.pipeline ]
is not included in
val init :
[< `Odbc_driver of
[< `Default
| `Options of
[ `DSN of string ] * [ `User of string ] *
[ `Password of string ] ]
| `Pgsql_driver of
[< `Default
| `Options of
[< `Client_encoding of string
| `DB of string
| `Debug_log of string
| `Debug_options of string
| `Host of string
| `Hostaddr of string
| `Password of string
| `Port of int
| `SSL of string
| `User of string ]
list
| `String of string ] ] ->
[> `Odbc_driver of Odbc_driver.pipeline
| `Pgsql_driver of Pgsql_driver.pipeline ]

--
*********************************************************************

Ing. Alessandro Baretta

Studio Baretta
http://studio.baretta.com/

Consulenza Tecnologica e Ingegneria Industriale
Technological Consulting and Industrial Engineering

Headquarters
tel. +39 02 370 111 55
fax. +39 02 370 111 54

Lab
tel. +39 02 9880 271
fax. +39 02 9828 0296

_______________________________________________
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

Jacques Garrigue

unread,
Aug 22, 2006, 8:03:29 PM8/22/06
to a.ba...@studio.baretta.com
From: Alessandro Baretta <a.ba...@studio.baretta.com>

> I'm back to my usual tuareg-mode session, and I'm back to my usual typing
> trouble. Does the following error message, coming from a fresh installation of
> ocaml 3.09.2, make any sense.
>
> Values do not match:
> val init :
> [< `Odbc_driver of
> [< `Default
> | `Options of
> [< `DSN of string ] * [< `User of string ] *
> [< `Password of string ] ]
> | `Pgsql_driver of
> [< `Default
> | `Options of
> [< `Client_encoding of string
>
> (* The problem seems to be here: shouldn't 'x & string unify trivially *)
> (* for any type variable 'x? *)

Indeed, so this is probably not the problem


> | `DB of 'a & string
> | `Debug_log of 'b & string
> | `Debug_options of 'c & string
> | `Host of 'd & string
> | `Hostaddr of 'e & string
> | `Password of 'f & string
> | `Port of 'g & int
> | `SSL of 'h & string
> | `User of 'i & string ]
> list
> | `String of string

The next line seems to be the problem:

Looks like your implementation contains at least `Options, while the
interface doesn't. Since it is in a contravariant position, you should
be able to remove it from the implementation by subtyping.

Jacques Garrigue

Alessandro Baretta

unread,
Aug 24, 2006, 11:06:44 AM8/24/06
to Ocaml
Jacques Garrigue wrote:
> From: Alessandro Baretta <a.ba...@studio.baretta.com>

> Looks like your implementation contains at least `Options, while the
> interface doesn't. Since it is in a contravariant position, you should
> be able to remove it from the implementation by subtyping.
>
> Jacques Garrigue

Ah, yes! The error message was so long that I missed the relevant spot, and the
`&' sign tricked me into thinking that the issue was there. And, yes, the
problem is the "> `Options" constraint, which appears in the inferred signature
of the function, but not in the mli.

Thank you very much.

Alex

0 new messages