From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 CDD73BC8A for ; Sun, 30 Jan 2005 08:19:28 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0U7JScY026051 for ; Sun, 30 Jan 2005 08:19:28 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA08508 for ; Sun, 30 Jan 2005 08:19:28 +0100 (MET) Received: from nexus.stwing.upenn.edu (NEXUS.STWING.UPENN.EDU [165.123.132.61]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0U7JQUM001347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sun, 30 Jan 2005 08:19:27 +0100 Received: from force.stwing.upenn.edu (force.stwing.upenn.edu [165.123.132.65]) by nexus.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id j0U7JPHA029828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sun, 30 Jan 2005 02:19:25 -0500 (EST) Received: from force.stwing.upenn.edu (localhost [127.0.0.1]) by force.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id j0U7JOh4003223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 30 Jan 2005 02:19:24 -0500 (EST) Received: (from wlovas@localhost) by force.stwing.upenn.edu (8.12.10/8.12.9/Submit) id j0U7JOKa003222 for caml-list@inria.fr; Sun, 30 Jan 2005 02:19:24 -0500 (EST) Date: Sun, 30 Jan 2005 02:19:23 -0500 From: William Lovas To: caml-list Subject: Re: [Caml-list] cyclic types Message-ID: <20050130071922.GA2798@force.stwing.upenn.edu> Mail-Followup-To: caml-list References: <7f8e92aa0501290415321a8e46@mail.gmail.com> <6b8a914205012905427c79cd85@mail.gmail.com> <7f8e92aa05012909335800c97@mail.gmail.com> <1F350A61-7250-11D9-866D-000D9345235C@inria.fr> <7f8e92aa050129220540e72c6d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f8e92aa050129220540e72c6d@mail.gmail.com> User-Agent: Mutt/1.5.4i X-Miltered: at nez-perce with ID 41FC8A80.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41FC8A7E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lovas:01 wlovas:01 stwing:01 upenn:01 caml-list:01 wrote:01 abbreviation:01 abbreviation:01 datatype:01 coercions:01 constructors:01 right-hand:01 cheers:01 equality:01 defining:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Sun, Jan 30, 2005 at 08:05:23AM +0200, Radu Grigore wrote: > Only one (small) problem remains. I do not understand this: > > # type t = t StringMap.t option;; > The type abbreviation t is cyclic > # type t = Some of t StringMap.t | None;; > type t = Some of t StringMap.t | None The first is a type abbreviation, while the second is a datatype declaration. They both introduce a new type, in some sense: the first does so by asserting its equality to some existing type, while the second does so by defining one or more coercions from existing types to the new type (i.e. constructors). Only the second can refer to the type being defined on the right-hand side, for the reasons mentioned earlier. cheers, William