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.2 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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id A0679BBAF for ; Tue, 6 Oct 2009 15:15:08 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqYFAHbfykrUnwdkdWdsb2JhbACCH5hXAQwKCQkTBLgZhCoEgVM X-IronPort-AV: E=Sophos;i="4.44,513,1249250400"; d="scan'208";a="48052768" Received: from relay.pcl-ipout02.plus.net ([212.159.7.100]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Oct 2009 15:15:07 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AroFALPfykrUnw4R/2dsb2JhbACCH9EuhCoEgVM Received: from pih-relay04.plus.net ([212.159.14.17]) by relay.pcl-ipout02.plus.net with ESMTP; 06 Oct 2009 14:15:05 +0100 Received: from [87.114.87.187] (helo=leper.local) by pih-relay04.plus.net with esmtp (Exim) id 1Mv9se-0000kc-RE for caml-list@yquem.inria.fr; Tue, 06 Oct 2009 14:15:05 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Constructors are not functions Date: Tue, 6 Oct 2009 14:15:48 +0100 User-Agent: KMail/1.9.9 References: <4ACB319A.1080608@wanadoo.fr> <003901ca4682$d47f8460$7d7e8d20$@metastack.com> In-Reply-To: <003901ca4682$d47f8460$7d7e8d20$@metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910061415.48065.jon@ffconsultancy.com> X-Plusnet-Relay: 9e16e5aea1e6b7ed38ecf5f3ed79af64 X-Spam: no; 0.00; constructors:01 constructors:01 simulate:01 ocaml:01 camlp:01 foo:01 2009:98 frog:98 sml:01 sml:01 unbound:01 wrote:01 partial:01 caml-list:01 caml-list:01 On Tuesday 06 October 2009 13:45:04 David Allsopp wrote: > > Is there a reason for constructors not to behave like functions? For > > instance, one cannot make a partial application from a constructor: > > This is how SML handles constructors, Xavier explained the reasons he chose > to depart from this in: > > http://caml.inria.fr/pub/ml-archives/caml-list/2001/08/47db53a4b42529708647 >c9e81183598b.en.html > > I think it would be possible to simulate the SML behaviour in OCaml using > camlp4 (if you assume that for [type foo = Bar of int] that future unbound > references to [bar] are interpreted as [fun x -> bar x] instead of an > error) Only if you turned multi-argument type constructors into single-argument ones taking a tuple, i.e. type definitions like: type t = Bar of int * int must become: type t = Bar of (int * int) -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e