From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 403DABC73 for ; Wed, 23 Aug 2006 01:32:10 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7MNW96T023574 for ; Wed, 23 Aug 2006 01:32:09 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA25948 for ; Wed, 23 Aug 2006 01:32:08 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k7MNW6Hl023563 for ; Wed, 23 Aug 2006 01:32:07 +0200 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.7/8.13.7) with ESMTP id k7MNP4FU011783; Wed, 23 Aug 2006 08:25:04 +0900 (JST) Date: Wed, 23 Aug 2006 08:24:59 +0900 (JST) Message-Id: <20060823.082459.99830220.garrigue@math.nagoya-u.ac.jp> To: a.baretta@studio.baretta.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] 'a & string unification issue From: Jacques Garrigue In-Reply-To: <44EB38CA.8080800@studio.baretta.com> References: <44EB38CA.8080800@studio.baretta.com> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 44EB93F9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44EB93F6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; unification:01 baretta:01 baretta:01 ocaml:01 val:01 unify:01 val:01 subtyping:01 dsn:98 dsn:98 typing:01 caml-list:01 int:01 int:01 match:02 From: Alessandro Baretta > 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: > > `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 ] 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