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.2 required=5.0 tests=AWL,DNS_FROM_RFC_POST, 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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 4617CBBAF for ; Tue, 6 Oct 2009 23:55:17 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqgDAO1Yy0rRVdnai2dsb2JhbACDAo46iQA/AQEBCgsKBxEFqCWBO483AQMDBYQlBIFT X-IronPort-AV: E=Sophos;i="4.44,515,1249250400"; d="scan'208";a="48088662" Received: from mail-gx0-f218.google.com ([209.85.217.218]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Oct 2009 23:55:16 +0200 Received: by gxk10 with SMTP id 10so5313761gxk.3 for ; Tue, 06 Oct 2009 14:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=sklKfT3iEKYJeRbx+RB7tWGkZlumgnn6fpxFCTf0FMc=; b=gW36YkHZNPP0psqWisSOfIFvTiKvKZhY9jIPtDXtOMKm/WHa1ADXrpOyTwsB52ThqF zH7uJWsAO1IRdOOlgGe11I6ZBTAeICWRAgYijDwvOP/PObtDdNuV2Kj9wIqGmfSbtu7e n1oHSND+6j7OUn8c2o/hfIp2HU1wJGg3ydCXY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=XskloxlrT7j7d7gwQYorpAMLQ6MNdY2WElKoIuriu6VsF0sdu1PCO704X6bsJNjtKs afYGJIw02lm6kPSk2GycwMVvYRmHd+jeSILvCzqejwDVbHPC2Ln6eC9R80YN2du+o44d Lo2Wroj4tBqZowNkgix2+EK+tyJ+l6Zor+ahg= MIME-Version: 1.0 Received: by 10.101.131.7 with SMTP id i7mr2180852ann.31.1254866113619; Tue, 06 Oct 2009 14:55:13 -0700 (PDT) In-Reply-To: <1254844259.2737.22.camel@localhost.localdomain> References: <4ACB319A.1080608@wanadoo.fr> <1254844259.2737.22.camel@localhost.localdomain> Date: Tue, 6 Oct 2009 23:55:12 +0200 Message-ID: <527cf6bc0910061455ndfcfe30g924aada8d03973ea@mail.gmail.com> Subject: Re: [Caml-list] Constructors are not functions From: blue storm To: =?ISO-8859-1?Q?J=E9r=E9mie_Dimino?= Cc: Chantal KELLER , caml-list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; constructors:01 constructors:01 camlp:01 syntax:01 prepend:01 camlp:01 constr:01 storm:98 2009:98 wrote:01 wrote:01 naming:01 caml-list:01 functions:01 constructor:01 On Tue, Oct 6, 2009 at 5:50 PM, J=E9r=E9mie Dimino wro= te: > This does not answer the question, but you can have function generated > automatically for constructors using camlp4. > > I wrote some time ago an extension which add a type-conv type processor > "constructor", so you can write: > > The extension is available here: > http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=3Dobus;a=3Dheadblob;f= =3D/syntax/pa_constructor.ml I also have an old extension of mine, wich use a slightly different naming scheme (prepend a "_" instead of uncapitalization), and also provides destructors for record types : http://bluestorm.info/camlp4/ty_constr.ml.html