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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 58EC37EDE3 for ; Thu, 11 Oct 2012 21:04:13 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of rathereasy@gmail.com) identity=pra; client-ip=209.85.212.174; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="rathereasy@gmail.com"; x-sender="rathereasy@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of rathereasy@gmail.com designates 209.85.212.174 as permitted sender) identity=mailfrom; client-ip=209.85.212.174; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="rathereasy@gmail.com"; x-sender="rathereasy@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wi0-f174.google.com) identity=helo; client-ip=209.85.212.174; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="rathereasy@gmail.com"; x-sender="postmaster@mail-wi0-f174.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjgCAMsXd1DRVdSujWdsb2JhbABErVGRfAgjAQEBAQkJCwkSBiOCIAEBAQQSAhMZARsSCwEDDAYFCw0NISIBEQEFAQoSBhMSEIdPAQMPC5sTCQOMJoJ2hSIKGScDClmIdQEFDIs7hiADiFiNFYEVjToWKYQv X-IronPort-AV: E=Sophos;i="4.80,573,1344204000"; d="scan'208";a="158748834" Received: from mail-wi0-f174.google.com ([209.85.212.174]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 11 Oct 2012 21:04:02 +0200 Received: by mail-wi0-f174.google.com with SMTP id hq7so7142759wib.9 for ; Thu, 11 Oct 2012 12:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=gXFLzlv3NWTZRVAHEVVoXaXdhHRvLUG5zDetEmZI798=; b=ARUfKBW+EZqFuHwx+ExLDLRKUcu2kEc2I0qWMxOq3c6B4Zskx9fG1U4DVUmJKM5gJ9 YR8QHF8EBhCr6rBpWV0KoRk53QH9F3aJocqpHvQAK7RYFautWKCFHDjDkb1bfXd0x6TO ILcoDxrJe92tqEdvzfuA+rpco/VzALdNFUmp4R6ZmCRiKkNI/hW57P+Tl72qp47jkcYf pwk3euLhurRpndspnbvvWdNe+LKfYiukCPZudMc86L/h3MyjJF9eem14TIwj9ieDPmU7 drlUUWF1iwXUeJE77IlojzrB8KOBP+5giKmKiWoLKWlJ0WTCzf2lYqbM+Eig11GEwG2b nAPA== MIME-Version: 1.0 Received: by 10.181.13.208 with SMTP id fa16mr27229wid.11.1349982242337; Thu, 11 Oct 2012 12:04:02 -0700 (PDT) Received: by 10.223.202.198 with HTTP; Thu, 11 Oct 2012 12:04:02 -0700 (PDT) In-Reply-To: <800E1F0B-8658-49A2-BA12-88F760F5E083@in.tum.de> References: <800E1F0B-8658-49A2-BA12-88F760F5E083@in.tum.de> Date: Thu, 11 Oct 2012 12:04:02 -0700 Message-ID: From: Jacques Le Normand To: Markus Weissmann Cc: OCaml mailing list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Exhaustiveness, currying with GADTs 2) seems to be the value restriction. basically, only constructors, composition of constructors and lambdas can generalize. What warning are you getting for 1) ? On Thu, Oct 11, 2012 at 10:30 AM, Markus Weissmann wrote: > Hello, > > while playing around with GADTs, I came across two issues I don't underst= and: The exhaustiveness check and currying functions. > 1.) I get a warning about my match (in function "componentwise") not bein= g exhaustive, while imho it obviously is: > > --------8<---------- > type d2 > type d3 > > type _ t =3D > | Vector2 : (float * float) -> d2 t > | Vector3 : (float * float * float) -> d3 t > > let componentwise : type d . (float -> float -> float) -> d t -> d t ->= d t =3D fun f v1 v2 -> > match (v1, v2) with > | (Vector2 (x1, y1), Vector2 (x2, y2)) -> Vector2 (f x1 x2, f y1 y1) > | (Vector3 (x1, y1, z1), Vector3 (x2, y2, z2)) -> Vector3 (f x1 x2, f= y1 y1, f z1 z2) > -------->8---------- > > 2.) When I use "componentwise" for other functions, I cannot do this: > > let add =3D componentwise (+.) > > ("contains type variables that cannot be generalized") > Fair enough. But I also cannot do this: > > let add : type d . d t -> d t -> d t =3D componentwise (+.) > > ("This definition has type 'd t -> 'd t -> 'd t which is less general tha= n 'd0. 'd0 t -> 'd0 t -> 'd0 t") > Only the "full" version works: > > let add : type d . d t -> d t -> d t =3D fun v1 v2 -> componentwise (+.= ) v1 v2 > > > I would be very happy if someone could shed some light especially on 1.). > > > Thanks & regards > -Markus > > -- > Markus Wei=DFmann, M.Sc. > Technische Universit=E4t M=FCnchen > Institut f=FCr Informatik > Boltzmannstr. 3 > D-85748 Garching > Germany > http://wwwknoll.in.tum.de/ > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs