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=2.8 required=5.0 tests=DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 52168BBAF for ; Mon, 20 Apr 2009 22:46:01 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqYEAF987ElIDvb2a2dsb2JhbACCIDGTLD8NCgsHEASrD4EJjnYBAwEDg3oG X-IronPort-AV: E=Sophos;i="4.40,219,1238968800"; d="scan'208";a="26540588" Received: from ag-out-0708.google.com ([72.14.246.246]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 Apr 2009 22:45:46 +0200 Received: by ag-out-0708.google.com with SMTP id 31so734137aga.9 for ; Mon, 20 Apr 2009 13:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=eljDfIceIgKv61igj7os+/v6Eo/k7KqK4zvyOxsLHq0=; b=oHKQ0yemUf0fM3qzqLFGBnJ90enV6zjXzgNN/XJR8s7bVAuo+K9IOkpwdjzbnXyu/a 8YVjEJ5V34HK83QMYo8IJdVpIHmQf1leV+3glJxDElMf14oZ7HT/6bm+uxmLHDaP+uPU Fe76tmoZWfFe5cXXMkD/fKKPtJlqDp1wr7DI4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ttSDgvN/ehffCT7soSphMVBkLB9/U5h49/BwpifYXPWopXnBmA+4Tr4+WsuLCmGGW6 xhmLZAZHiyS7h2PiKeg9ZQeG6+pBgaqRkA36YLsYgtXkUK+rjCybsUxG0Mxatgy7NELF IhZR8Joo+K3zzONSQgi8kvlH/AciDTtwyYQSA= MIME-Version: 1.0 Received: by 10.151.42.12 with SMTP id u12mr1911527ybj.223.1240260345423; Mon, 20 Apr 2009 13:45:45 -0700 (PDT) Date: Mon, 20 Apr 2009 22:45:45 +0200 Message-ID: Subject: Interpretation of an error message "type ('a, 'b) t should be ('a, 'c) t" in a signature? From: Jean Balthazar To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=00151751149a5166fe0468029d54 X-Spam: no; 0.00; sig:01 sig:01 W8:98 caml-list:01 caml-list:01 mly:01 define:02 define:02 archives:02 archives:02 W4:96 module:03 module:03 derived:05 derived:05 --00151751149a5166fe0468029d54 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Dear caml-list, I try to define the signature of three interdependant classes that should then be derived and completed for various implementation. The code below causes the strange error messsage: File "tmp.ml", line 4, characters 7-92: In the definition of job, type ('a, 'b) batch should be ('a, 'c) batch Can you explain what is wrong with this signature? I was unable to find an answer to a similar problem in the archives. Thank you very much. Jean ---------------------------------------------------------------------------- module type JOB = sig type ('a, 'b) batch = private < build : 'a job -> ('a priority * 'a) list -> 'b job; .. > and 'b priority = private < next : 'b priority; .. > and 'a job = private < create_batch : 'c.('a -> 'c) -> ('a, 'c) batch; .. > end --00151751149a5166fe0468029d54 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear caml-list,

I try to define the signature of three interdependan= t classes that should then be derived and completed for various implementat= ion. The code below causes the strange error messsage:

=A0=A0=A0=A0 = =A0 =A0 File "tmp.ml", line 4, char= acters 7-92:
=A0=A0=A0=A0=A0=A0=A0=A0 In the definition of job, type ('a, 'b) ba= tch should be ('a, 'c) batch

Can you explain what is wrong w= ith this signature?
I was unable to find an answer to a similar problem = in the archives.

Thank you very much.
Jean

-----------------------------------= -----------------------------------------
=A0
module type JOB =3D
= sig

=A0 type ('a, 'b) batch =3D=A0 private < build : '= ;a job -> ('a priority * 'a) list -> 'b job; .. >
=A0 and 'b priority =3D private < next : 'b priority;=A0 ..=A0 &= gt;
=A0 and 'a job =3D=A0 private < create_batch : 'c.('a= -> 'c) -> ('a, 'c) batch; ..=A0 >

end

<= br>
--00151751149a5166fe0468029d54-- 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.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 43BBBBBAF for ; Tue, 21 Apr 2009 04:45:38 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAAvQ7EmCNhAB/2dsb2JhbADQc4N9Bg X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="28003045" Received: from kurims.kurims.kyoto-u.ac.jp ([130.54.16.1]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Apr 2009 04:45:36 +0200 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.8/8.13.8) with ESMTP id n3L2jVeH020221; Tue, 21 Apr 2009 11:45:31 +0900 (JST) Date: Tue, 21 Apr 2009 11:45:18 +0900 (JST) Message-Id: <20090421.114518.212473943.garrigue@math.nagoya-u.ac.jp> To: jean.balthazar.fr@gmail.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Interpretation of an error message "type ('a, 'b) t should be ('a, 'c) t" in a signature? From: Jacques Garrigue In-Reply-To: References: X-Mailer: Mew version 4.2 on Emacs 22.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; occurences:01 occurences:01 type-checker:01 sig:01 caml-list:01 explicitly:02 define:02 define:02 archives:02 variables:02 confusing:02 garrigue:03 garrigue:03 module:03 jacques:03 This is exactly the same problem as your previous post. You are trying to define a non-regular type. I.e., if you expand the definition of job, you get: type ('a,'b) batch = private < build : < create_batch : 'c.('a -> 'c) -> ('a,'c) batch; .. > -> ('a priority * 'a) list -> < create_batch : 'c.('b -> 'c) -> ('b,'c) batch; .. > ; .. > (not a correct definition because job itself is a private row type, but this is just to show explicitly the occurences of batch) All occurences of batch inside its own definition should have the same parameters ('a,'b), but here both have different parameters. I admit that the error message is a bit confusing because all parameters are variables, and their names are not preserved by the type-checker. If the name were preserved, this would be type ('a, 'c) batch should be ('a, 'b) Jacques Garrigue From: Jean Balthazar > I try to define the signature of three interdependant classes that should > then be derived and completed for various implementation. The code below > causes the strange error messsage: > > File "tmp.ml", line 4, characters 7-92: > In the definition of job, type ('a, 'b) batch should be ('a, 'c) > batch > > Can you explain what is wrong with this signature? > I was unable to find an answer to a similar problem in the archives. > > Thank you very much. > Jean > > ---------------------------------------------------------------------------- > > module type JOB = > sig > > type ('a, 'b) batch = private < build : 'a job -> ('a priority * 'a) list > -> 'b job; .. > > and 'b priority = private < next : 'b priority; .. > > and 'a job = private < create_batch : 'c.('a -> 'c) -> ('a, 'c) batch; > .. > > > end