From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 00AD6BBAF for ; Sun, 5 Dec 2010 09:10:22 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar0AAB7Y+kzRVdg0kGdsb2JhbACjKggVAQEBAQkJDAcRBB6kfolpghmEBC6IVgEBAwWFRASKboYF X-IronPort-AV: E=Sophos;i="4.59,301,1288566000"; d="scan'208";a="91526343" Received: from mail-qw0-f52.google.com ([209.85.216.52]) by mail1-smtp-roc.national.inria.fr with ESMTP; 05 Dec 2010 09:10:22 +0100 Received: by qwe4 with SMTP id 4so5384438qwe.39 for ; Sun, 05 Dec 2010 00:10:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=C6uNnY1S+7r68mDqH4aGDraeYHyTA2UFyjnf62xjmgI=; b=gYUro2xTZ3CwCpXBuFj3keIVO7D/Cx408qFzh7zhN6z6lT2Ws2zfjCYzxUUau32U4E b+xZLMqp6mj/huBZIkSxhcAXNm8RVyZD69FDvPy+bIy8g2YV13baZ/hANntDbLLmU2sg wNvzSMA5XPoLqfefKr7h+qkT4VeGQy0h3ltFI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=O+QFSCNPrC4WRJFLz3PyYgZYBGGGii8k8kqtxNUcusR8cNJEnBeeT99sZy3edNqCji mbYzVVQbFYF8EWNRMm1v3UNh8XI12E/SblH8fXj47iNgLIklZoczmDLL8WMBtSSInsrU 6s8lFNNaxAmkafoZZ3JuzIdwinVYybEeN7kOA= Received: by 10.229.232.205 with SMTP id jv13mr3107444qcb.68.1291536621680; Sun, 05 Dec 2010 00:10:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.230.149 with HTTP; Sun, 5 Dec 2010 00:10:01 -0800 (PST) In-Reply-To: References: From: Lukasz Stafiniak Date: Sun, 5 Dec 2010 09:10:01 +0100 Message-ID: Subject: Re: [Caml-list] GADT constructor syntax To: Jacques Le Normand Cc: caml-list caml-list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; lukasz:01 syntax:01 restricting:01 quantified:01 notation:01 existential:01 ocaml:01 conciseness:01 wrote:01 typing:01 caml-list:01 constructor:01 exceptions:01 constraint:01 constraint:01 On Sat, Dec 4, 2010 at 10:06 PM, Jacques Le Normand wrote: > in this case, yes, but if you have constraints then it is different. cons= ider: > > type 'a term =3D > =A0 =A0 =A0| Ignore of 'a : int term > =A0 =A0 =A0| Embed of 'a > =A0 constraint 'a =3D int > > this is different from: > > type 'a term =3D > =A0 =A0 | Ignore of 'a : int term > =A0 =A0 | Embed of 'a : 'a term > =A0 constraint 'a =3D int > > (in fact, an error is flagged on the second one) > > Also, it can save the user some typing. I don't think that it is very different. Standard-language constraints are outside of implications, so they apply to each branch. It already behaves this way in the standard language, basically restricting the type family to "int term". So I don't see why > | Embed of 'a : 'a term > =A0 constraint 'a =3D int shouldn't mean that Embed is "basically" Embed of int : int term. My position is that if a type variable should be treated as local to a branch, it should be explicitly quantified (using the dot notation, for example "Ignore of 'a. 'a : int term", without any exceptions to "existential" variables). And that the patterns type X =3D | Branch of Y and type X =3D | Branch of Y : X should be equivalent (where X could for example be 'a term). I would accept concessions to my general outlook on the grounds of being conservative over standard OCaml programmer intuitions and conciseness of code... when they apply...