From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 04D97BC37 for ; Thu, 10 Dec 2009 12:56:51 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmUCABdxIEtQDPJjfGdsb2JhbACEJZdBAQELCQoHEwWpQpAgg1lTBIFjgTWDPA X-IronPort-AV: E=Sophos;i="4.47,374,1257116400"; d="asc'?scan'208,217";a="38353360" Received: from smtp28.orange.fr ([80.12.242.99]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Dec 2009 12:56:50 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2828.orange.fr (SMTP Server) with ESMTP id 721EF800020D for ; Thu, 10 Dec 2009 12:56:50 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2828.orange.fr (SMTP Server) with ESMTP id 65BA980001FF for ; Thu, 10 Dec 2009 12:56:50 +0100 (CET) Received: from [192.168.1.2] (LAubervilliers-153-53-1-14.w217-128.abo.wanadoo.fr [217.128.128.14]) by mwinf2828.orange.fr (SMTP Server) with ESMTP id 325EA800020D for ; Thu, 10 Dec 2009 12:56:50 +0100 (CET) X-ME-UUID: 20091210115650206.325EA800020D@mwinf2828.orange.fr Subject: revised syntax for abstract types ? From: Serge Leblanc To: caml-list@yquem.inria.fr Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-4j7G1J3hVRkhtHiEElLZ" Date: Thu, 10 Dec 2009 12:56:44 +0100 Message-Id: <1260446204.22959.298.camel@serge2.localnet> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 X-Spam: no; 0.00; syntax:01 syntax:01 ocaml:01 camlp:01 gpg:01 3324:01 ocaml:01 camlp:01 gpg:01 3324:01 ubuntu:98 ubuntu:98 333399:98 333399:98 unbound:01 X-Attachments: cset="utf-8" type="application/pgp-signature" name="signature.asc" --=-4j7G1J3hVRkhtHiEElLZ Content-Type: multipart/alternative; boundary="=-cGks6ed2daXPqYJuA7Lc" --=-cGks6ed2daXPqYJuA7Lc Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, the documentation for the revised syntax explain that abstract types are expressed by : type bar =3D 'a; but ocaml returns an error. # Objective Caml version 3.11.1 Camlp4 Parsing version 3.11.1 # type bar =3D 'a ; Error: Unbound type parameter 'a http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html Thanks, -- Serge Leblanc gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x33243C1B Fingerprint =3D 066C 005F 5595 D85C 7673 D969 1DD4 90C4 3324 3C1B --=-cGks6ed2daXPqYJuA7Lc Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, the documentation for the revised syntax explain that abstract types ar= e expressed by :
type bar =3D 'a; but ocaml returns an error.


#
        Objective Caml version 3.11.1
Camlp4 Parsing version 3.11.1

# type bar =3D 'a ;
Error: Unbound type parameter 'a

http= ://caml.inria.fr/pub/docs/manual-camlp4/manual007.html

Thanks,
--
Serge Leblanc
gpg --keyserver  hkp://keyserver.ubuntu.com:11= 371 --recv-keys 0x33243C1B
Fingerprint =3D 066C 005F 5595 D85C 7673  D969= 1DD4 90C4 3324 3C1B
--=-cGks6ed2daXPqYJuA7Lc-- --=-4j7G1J3hVRkhtHiEElLZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAksg4fYACgkQHdSQxDMkPBuhtwCfVtz73S9LVM8WcFtBUOBugFdG NgoAoIKIqkpEb5GoIskGTJCIf0TGOb3F =4SBx -----END PGP SIGNATURE----- --=-4j7G1J3hVRkhtHiEElLZ-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2B10BBC37 for ; Thu, 10 Dec 2009 14:49:43 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.47,375,1257116400"; d="scan'208";a="38358923" Received: from peray.inria.fr (HELO localhost) ([128.93.8.98]) by mail2-relais-roc.national.inria.fr with ESMTP; 10 Dec 2009 14:49:43 +0100 Content-Type: text/plain; charset=UTF-8 Cc: caml-list Subject: Re: [Caml-list] revised syntax for abstract types ? From: Nicolas Pouillard To: Serge Leblanc In-reply-to: <1260446204.22959.298.camel@serge2.localnet> References: <1260446204.22959.298.camel@serge2.localnet> Date: Thu, 10 Dec 2009 14:49:43 +0100 Message-Id: <1260452934-sup-6342@peray> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; syntax:01 syntax:01 ocaml:01 2009:98 abstract:01 abstract:01 caml-list:01 revised:02 revised:02 serge:05 types:05 types:05 thu:05 dec:05 nicolas:08 Excerpts from Serge Leblanc's message of Thu Dec 10 12:56:44 +0100 2009: > Hi, the documentation for the revised syntax explain that abstract types > are expressed by : The documentation is too old, abstract types now have the same syntax in revised than in the original OCaml syntax. -- Nicolas Pouillard http://nicolaspouillard.fr From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id E8D2DBC37 for ; Thu, 10 Dec 2009 15:29:25 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwDALeUIEtDz4HegWdsb2JhbACbRwEBFiS6UIQrBIMY X-IronPort-AV: E=Sophos;i="4.47,375,1257116400"; d="scan'208";a="51871250" Received: from fettunta.fettunta.org ([67.207.129.222]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Dec 2009 15:29:25 +0100 Received: from usha.takhisis.invalid (unknown [10.17.0.10]) by fettunta.fettunta.org (Postfix) with ESMTPS id DBCB61848F for ; Thu, 10 Dec 2009 14:29:23 +0000 (UTC) Received: by usha.takhisis.invalid (Postfix, from userid 1000) id A973A6106; Thu, 10 Dec 2009 15:29:22 +0100 (CET) Date: Thu, 10 Dec 2009 15:29:22 +0100 From: Stefano Zacchiroli To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] revised syntax for abstract types ? Message-ID: <20091210142922.GA12408@usha.takhisis.invalid> References: <1260446204.22959.298.camel@serge2.localnet> <1260452934-sup-6342@peray> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1260452934-sup-6342@peray> User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam: no; 0.00; zacchiroli:01 zack:01 syntax:01 0100,:01 syntax:01 zacchiroli:01 postdoc:01 zack:01 10,:98 2009:98 2009:98 dietro:98 c'e:98 sempre:98 wrote:01 On Thu, Dec 10, 2009 at 02:49:43PM +0100, Nicolas Pouillard wrote: > Excerpts from Serge Leblanc's message of Thu Dec 10 12:56:44 +0100 2009: > > Hi, the documentation for the revised syntax explain that abstract types > > are expressed by : > > The documentation is too old Any chance that it will be updated any time soon? -- Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7 zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/ Dietro un grande uomo c'è ..| . |. Et ne m'en veux pas si je te tutoie sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 3207CBC37 for ; Thu, 10 Dec 2009 19:10:38 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0CAPvIIEtQDPJjfGdsb2JhbACEG5csAQELCQoHEwWrNpAQg1lSBIMYgzw X-IronPort-AV: E=Sophos;i="4.47,376,1257116400"; d="asc'?scan'208,217";a="38376657" Received: from smtp28.orange.fr ([80.12.242.99]) by mail2-smtp-roc.national.inria.fr with ESMTP; 10 Dec 2009 19:10:36 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2804.orange.fr (SMTP Server) with ESMTP id A8CB4700010F; Thu, 10 Dec 2009 19:10:35 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2804.orange.fr (SMTP Server) with ESMTP id 949A77000111; Thu, 10 Dec 2009 19:10:35 +0100 (CET) Received: from [192.168.1.2] (LAubervilliers-153-53-1-14.w217-128.abo.wanadoo.fr [217.128.128.14]) by mwinf2804.orange.fr (SMTP Server) with ESMTP id 1B109700010F; Thu, 10 Dec 2009 19:10:35 +0100 (CET) X-ME-UUID: 20091210181035110.1B109700010F@mwinf2804.orange.fr X-ME-User-Auth: serge.leblanc Subject: Re: [Caml-list] revised syntax for abstract types ? From: Serge Leblanc To: Nicolas Pouillard Cc: caml-list In-Reply-To: <1260452934-sup-6342@peray> References: <1260446204.22959.298.camel@serge2.localnet> <1260452934-sup-6342@peray> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-iUX5BDsoWAwo74AoOP4z" Date: Thu, 10 Dec 2009 19:10:28 +0100 Message-Id: <1260468628.22959.510.camel@serge2.localnet> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 X-Spam: no; 0.00; syntax:01 0100,:01 syntax:01 ocaml:01 arcs:01 arcs:01 gpg:01 3324:01 0100,:01 ocaml:01 gpg:01 3324:01 2009:98 2009:98 trie:98 X-Attachments: cset="utf-8" type="application/pgp-signature" name="signature.asc" --=-iUX5BDsoWAwo74AoOP4z Content-Type: multipart/alternative; boundary="=-VjRa4Jst/FFvDYT+yYtn" --=-VjRa4Jst/FFvDYT+yYtn Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2009-12-10 at 14:49 +0100, Nicolas Pouillard wrote: > Excerpts from Serge Leblanc's message of Thu Dec 10 12:56:44 +0100 2009: > > Hi, the documentation for the revised syntax explain that abstract type= s > > are expressed by : >=20 > The documentation is too old, abstract types now have the same syntax in > revised than in the original OCaml syntax. >=20 In the following types definitions, type trie 'a =3D [ Trie of arcs 'a ] and arcs 'a =3D list ('a * trie 'a); type zipper 'a =3D [ Top | Zip of (arcs 'a * 'a * arcs 'a * zipper 'a) ] and edit_state 'a =3D (zipper 'a * trie 'a); why is it not possible to describe them thus ? type letter =3D 'a; type trie =3D [ Trie of arcs ] and arcs =3D list (letter * trie); type zipper =3D [ Top | Zip of (arcs * letter * arcs * zipper) ] and edit_state =3D (zipper * trie); Thanks for your help. -- Serge Leblanc gpg --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x33243C1B Fingerprint =3D 066C 005F 5595 D85C 7673 D969 1DD4 90C4 3324 3C1B --=-VjRa4Jst/FFvDYT+yYtn Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, 2009-12-10 at 14:49 +0100, Nicolas Pouillard wrote:
Excerpts from Serge Leblanc's message of Thu Dec 10 12:56:44 +0100 2009:
> Hi, the documentation for the revised syntax explain that abstract typ=
es
> are expressed by :

The documentation is too old, abstract types now have the same syntax in
revised than in the original OCaml syntax.


In the following types definitions,

type trie 'a =3D [ Trie of arc= s 'a ]
and arcs 'a =3D list ('a * tri= e 'a);

type zipper 'a =3D [ Top | Zip of (arcs 'a * 'a * ar= cs 'a * zipper 'a) ]
and edit_state 'a =3D (zipper = 'a * trie 'a);

why is it not possible to describe them thus ?

type letter =3D 'a;
type trie =3D [ Trie of arcs ]=
and arcs =3D list (letter * tr= ie);

type zipper =3D [ Top | Zip of (arcs * letter * arcs * zipper) ]

and edit_state =3D (zipper * t= rie);

Thanks for your help.
--
Serge Leblanc
gpg --keyserver  hkp://keyserver.ubuntu.com:11= 371 --recv-keys 0x33243C1B
Fingerprint =3D 066C 005F 5595 D85C 7673  D969= 1DD4 90C4 3324 3C1B
--=-VjRa4Jst/FFvDYT+yYtn-- --=-iUX5BDsoWAwo74AoOP4z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAkshOYMACgkQHdSQxDMkPBtzVQCeJ65DiQB/66qKio2JA9onFXfX rfMAn3j0ggJQZXxb+SR6+bTV+GYKRVLb =jc4B -----END PGP SIGNATURE----- --=-iUX5BDsoWAwo74AoOP4z-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 98250BC37 for ; Fri, 11 Dec 2009 01:18:06 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmwBAP8eIUuFBoIFmWdsb2JhbACbOgEBAQEBCAsKBxOseo4qAQWEK4MB X-IronPort-AV: E=Sophos;i="4.47,377,1257116400"; d="scan'208";a="39671250" Received: from rabbit.math.nagoya-u.ac.jp (HELO mailhost.math.nagoya-u.ac.jp) ([133.6.130.5]) by mail3-smtp-sop.national.inria.fr with ESMTP; 11 Dec 2009 01:17:38 +0100 Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 35CCFB639; Fri, 11 Dec 2009 09:17:34 +0900 (JST) Received: from mailhost.math.nagoya-u.ac.jp (camel-172 [172.16.254.4]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id E8D6C88A9; Fri, 11 Dec 2009 09:17:33 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=math.nagoya-u.ac.jp; h= date:message-id:to:cc:subject:from:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=alpha; bh=1xa4rdVBaW4A8uU0a8XPVNx2wqI=; b=ATdbC0JzzHvHQLVNlM2e171ismph zAG/YVNSLBG+H8pMDc7cHsA+DDc67cCd9onx3TiliqE7o2JPrwImKXS9gxRgHH4F lSPbal6nc1fgauvFRTrVh9U8jv+RTqM8gw1QHKbyzXvvlzQMc5TnwVKgao9CMN+W iL7HHCnD8ISUqnI= DomainKey-Signature: a=rsa-sha1; h=Received:Date:Message-Id:To:Cc:Subject:From:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; b=C2ONwyjJsrQDfrONZ9VI2ec3ZnHJk2gAsRRD6MIQNMMf/6OR3O1FGXFL2qs367+s3fN1JlUcAUDpwoIlOaTWSYeY3QLU4AiC3aQVcE8RlUKzag++So7h56MsPmKw+vr8+TS1aYZH9S+wJO5pcM0DTMMkptp0MgzOcGzgvkGnfEI=; c=nofws; d=math.nagoya-u.ac.jp; q=dns; s=alpha Received: from localhost (bsdserver02 [172.16.249.2]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id BEF51889F; Fri, 11 Dec 2009 09:17:33 +0900 (JST) Date: Fri, 11 Dec 2009 09:14:56 +0900 (JST) Message-Id: <20091211.091456.04442319.garrigue@math.nagoya-u.ac.jp> To: serge.leblanc@orange.fr Cc: nicolas.pouillard@gmail.com, caml-list@yquem.inria.fr Subject: Re: [Caml-list] revised syntax for abstract types ? From: Jacques Garrigue In-Reply-To: <1260468628.22959.510.camel@serge2.localnet> References: <1260446204.22959.298.camel@serge2.localnet> <1260452934-sup-6342@peray> <1260468628.22959.510.camel@serge2.localnet> X-Mailer: Mew version 6.2.51 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; syntax:01 arcs:01 arcs:01 syntax:01 semantics:01 translating:01 elt:01 elt:01 polymorphism:01 checker:01 functors:01 sig:01 struct:01 struct:01 trie:98 From: Serge Leblanc > In the following types definitions, > > type trie 'a = [ Trie of arcs 'a ] > and arcs 'a = list ('a * trie 'a); > > type zipper 'a = [ Top | Zip of (arcs 'a * 'a * arcs 'a * zipper 'a) ] > and edit_state 'a = (zipper 'a * trie 'a); > > why is it not possible to describe them thus ? > > type letter = 'a; > type trie = [ Trie of arcs ] > and arcs = list (letter * trie); > > type zipper = [ Top | Zip of (arcs * letter * arcs * zipper) ] > and edit_state = (zipper * trie); Note first that revised syntax is just syntax, it does not change the semantics. So, translating your question on a simpler example in standard syntax, how does type 'a list = Nil | Cons of 'a * 'a list relate to type elt type list = Nil | Cons of elt * list The answer is that they describe the same data, but in an incompatible way. The first approach uses ML polymorphism, so that you can build a list of any given type, letting the type checker choose the element type. The second is a signature, and should be used in combination with functors, the type being chosen explicitly. For instance, you can write a map function in the following way: module type List = sig type elt type list = Nil | Cons of elt * list end module F(T:List) = struct open T let rec map f = function Nil -> Nil | Cons (h,t) -> Cons (f h, map f t) end module IntList = struct type elt = int type list = Nil | Cons of elt * list end module IntM = F(IntList);; IntM.map succ (IntList.Cons (1, IntList.Nil));; Again, these two definitions of list, while representing the same data, are incompatible. Hope this helps. Jacques Garrigue