From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 154E77EEFA for ; Fri, 13 Nov 2015 14:46:40 +0100 (CET) IronPort-PHdr: 9a23:5e0eGhQFiEb99lnlNRtu6SdYQdpsv+yvbD5Q0YIujvd0So/mwa64YBSN2/xhgRfzUJnB7Loc0qyN4/2mBDVLvcfJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbviptuOOk4U1XKUWvBbElaflU3prM4YgI9veO4a6yDihT92QdlQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGfayQ6NtRrVdCHEiMnspzMztrxjKCwWVtVUGVWBDqB1NCgnDpDvzRJv2r2OurO140SicFcbsXKgoXi+v6bxmDhTvjXFUZHYC7GjLh5ko3+pgqxW7qkknzg== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=romain@cryptosense.com; spf=None smtp.mailfrom=romain@cryptosense.com; spf=None smtp.helo=postmaster@8.mo69.mail-out.ovh.net Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of romain@cryptosense.com) identity=pra; client-ip=46.105.56.233; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="romain@cryptosense.com"; x-sender="romain@cryptosense.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of romain@cryptosense.com) identity=mailfrom; client-ip=46.105.56.233; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="romain@cryptosense.com"; x-sender="romain@cryptosense.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@8.mo69.mail-out.ovh.net) identity=helo; client-ip=46.105.56.233; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="romain@cryptosense.com"; x-sender="postmaster@8.mo69.mail-out.ovh.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0B5AACE6EVWnOk4aS5exTaDPYJTAgiBMjwQAQEBAQEBAQEQAQEBAQEGDQkJIS6CLYIIAQEEIw8BBTMNEQsYAgIFFgsCAgkDAgECAUUTCAKILgGwOZBXASyBAYkogSmFJxqCNIFEBZZIjgSbaDiCUoFehi4BAQE X-IPAS-Result: A0B5AACE6EVWnOk4aS5exTaDPYJTAgiBMjwQAQEBAQEBAQEQAQEBAQEGDQkJIS6CLYIIAQEEIw8BBTMNEQsYAgIFFgsCAgkDAgECAUUTCAKILgGwOZBXASyBAYkogSmFJxqCNIFEBZZIjgSbaDiCUoFehi4BAQE X-IronPort-AV: E=Sophos;i="5.20,287,1444687200"; d="scan'208";a="187389964" Received: from 8.mo69.mail-out.ovh.net ([46.105.56.233]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-GCM-SHA384; 13 Nov 2015 14:46:39 +0100 Received: from mail182.ha.ovh.net (gw6.ovh.net [213.251.189.206]) by mo69.mail-out.ovh.net (Postfix) with SMTP id AB238FFA0E2 for ; Fri, 13 Nov 2015 14:46:38 +0100 (CET) Received: from localhost (HELO queueout) (127.0.0.1) by localhost with SMTP; 13 Nov 2015 15:46:37 +0200 Received: from alille-655-1-132-116.w83-198.abo.wanadoo.fr (HELO ?192.168.1.15?) (romain@bardou.fr@83.198.207.116) by ns0.ovh.net with SMTP; 13 Nov 2015 15:46:32 +0200 To: caml-list@inria.fr References: <5645DC49.7050106@tu-berlin.de> <5645E255.5060900@freenet.de> From: Romain Bardou Message-ID: <5645E9B4.9080007@cryptosense.com> Date: Fri, 13 Nov 2015 14:46:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 16841210806850023968 X-Ovh-Remote: 83.198.207.116 (alille-655-1-132-116.w83-198.abo.wanadoo.fr) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: 0 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeekhedrheduucetufdoteggodftvfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecu X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeekhedrheduucetufdoteggodftvfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecu X-Validation-by: romain@cryptosense.com Subject: Re: [Caml-list] Cyclic type abbreviation On 13/11/2015 14:37, David Allsopp wrote: > Mr. Herr wrote: >> On 13.11.2015 13:49, Christoph Höger wrote: >>> Dear all, >>> >>> why is this type cyclic? >>> >>> type node = int * tree * tree >>> and tree = node option >>> >>> I cannot introduce a manifest for the option type, as there is no >>> Option module (why is that, btw?) - so I would assume option to be >>> special enough to be handled like any other algebraic data type. >> type 'a option = None | Some 'a >> >> no need for a module, just a simple type. Maybe you confound it with other >> languages. >> >> And cyclic - well, the types are referring to each other. >> >> Summary: what is supposedly wrong with it? > > I expect that what is wrong is that you can write: > > type node = int * tree * tree > and tree = Some of node > | None > > I don't know why you can't write [and tree = node option] instead. > > > David > Interestingly, this definition is accepted: type tree = (int * 'a * 'a) option as 'a Here you are helping the type-checker because you give it a "canonical" representation that it can use when unifying; it no longer has to expand the type, potentially infinitely. I think the main point is that the type is isorecursive, but I'm not really an expert on the subject. -- Romain Bardou