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.0 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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 1C1ADBC6B for ; Wed, 24 Oct 2007 19:44:33 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAIogH0dCm3xrnWdsb2JhbACOWgIBAQsPCA X-IronPort-AV: E=Sophos;i="4.21,325,1188770400"; d="scan'208";a="3605100" Received: from janestcapital.com (HELO smtp.janestcapital.com) ([66.155.124.107]) by mail1-smtp-roc.national.inria.fr with ESMTP; 24 Oct 2007 19:44:32 +0200 Received: from [172.25.129.161] [38.96.172.125] by janestcapital.com with ESMTP (SMTPD-9.10) id A47E05A4; Wed, 24 Oct 2007 13:44:30 -0400 Message-ID: <471F847C.1050609@janestcapital.com> Date: Wed, 24 Oct 2007 13:44:28 -0400 From: Brian Hurt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: William W Smith Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] type abbreviation is cyclic References: <344522.90449.qm@web82102.mail.mud.yahoo.com> In-Reply-To: <344522.90449.qm@web82102.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; abbreviation:01 abbreviation:01 inserting:01 emptylist:01 wrote:01 caml-list:01 cyclic:01 cyclic:01 int:01 int:01 data:02 structures:02 defined:02 cons:04 types:05 William W Smith wrote: > I wonder whether this error is an example of the language being > defined more restrictively than required. What is the reason that I > get these results? > > type a = int -> one -> int and one = Unused | One of a;; > type b = int -> b -> int > > type a is accepted while type b is not. (b gives "The type > abbreviation b is cyclic" However, in the uses that I intended, there > won't be any actual difference between the two. > > I'd appreciate an explanation about why there is difference between a > and b. I *think* this has to do with being able to bottom out data structures. I mean, consider the following two (similiar) types: type a = int * one * int and one = Unused | One of a;; type b = int * b * int;; How do you specify a limited-length member of type b? You can with a just by inserting Unused in the correct location. But there's no such "stopping point" for b. This makes more sense when you make the linked-list aspect more plain: type a = int * next and next = EmptyList | Cons of a;; type b = int * b;; Hopefully someone more knowledgeable than I will post an actual type-theoretical reason this is so, but this is the pragmatic reason I've found. Brian