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 AA0077EE4B for ; Thu, 10 Oct 2013 10:09:54 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dhouse@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of dhouse@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="dhouse@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dhouse@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag8CALRfVlImacjlnGdsb2JhbABZgz9SrkaSIjiBFx4OAQEBAQEGFgk8giUBAQUnGQEBLAsBDwsLAwoNISISAQUBChIGExIIh1oDDwMJmmeLDYRQAQWEYQOJbwaPRweEI5gIgS+OaBgphE8 X-IPAS-Result: Ag8CALRfVlImacjlnGdsb2JhbABZgz9SrkaSIjiBFx4OAQEBAQEGFgk8giUBAQUnGQEBLAsBDwsLAwoNISISAQUBChIGExIIh1oDDwMJmmeLDYRQAQWEYQOJbwaPRweEI5gIgS+OaBgphE8 X-IronPort-AV: E=Sophos;i="4.90,1070,1371074400"; d="scan'208";a="36358938" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Oct 2013 10:09:52 +0200 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VUBJf-0008KP-8w for caml-list@yquem.inria.fr; Thu, 10 Oct 2013 04:09:51 -0400 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VUBJf-0004pV-86 for caml-list@yquem.inria.fr; Thu, 10 Oct 2013 04:09:51 -0400 Received: from mail-qa0-f42.google.com ([209.85.216.42]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VUBJf-0005XE-5q for caml-list@yquem.inria.fr; Thu, 10 Oct 2013 04:09:51 -0400 Received: by mail-qa0-f42.google.com with SMTP id w8so296545qac.15 for ; Thu, 10 Oct 2013 01:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SK1DdMdogBD+ftzFU2Dx0x23VhNy7Go0UsifgnAHVlg=; b=ea34676mkgxGKRnXCnwZAREI1X0bDw1WjgM3SEppTHDUHWISbDV5CCMIiiFPDuTXwV rc28E7XbjR1Tkhp0IcrA42XaC+nBY23mVXtkmaBDu7MTLJAWRFqUIeybyho5sSvl0oyP POdgOXhTab3A0AcbAEcBatkmW5eR9zj80fP4E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=SK1DdMdogBD+ftzFU2Dx0x23VhNy7Go0UsifgnAHVlg=; b=LEtbyfQBD2tBGG4jNzYnqbD9K4AoQ2o2mzAiNEn86kn5D6fiCtS2dKHWNVeZ5z4dZY ZZh5IwJUOdQcsmPKiL5Jii6iKtrc1/dCbFuQm1OOFxgWYfxxd/doCgxc243fQ7JbngDq ZtuFNhn/EMvKOMizwicL7E/pNJM/w7vrnux6Hh77WIYOiq5jqJoSzdXx4nnrnT32UYO8 ht3evYXh9wiNM2l9N1LmS1oXKeYnEUvp7r1m27kpTjXTV27WSp2gZkA6uJwdzhPJ5gPS yxY6U0teiVRCaXmCE0+5ON1JQwCvQrfHlKG07XrCXS1kQ5A0/OZXdo/c5Gh539HCOyU4 vQNA== X-Gm-Message-State: ALoCoQmE8MNGn8UIgOI4A4I4Uz4DSAZoOJQaE71B2zAY5703UJeQ4GUQrBqrcyuNCdPa2ExsL1CQhQSlbJz1UPzWaVH3H7U1Ory4xPYKxEsYNwjKgy07tdLvI14jKXSTHe5/aQpBrgTkJ3gacrhFoJ4PK+/XcaIvDa2em1t3amF4JMXDFTx3jZ4= X-Received: by 10.49.5.231 with SMTP id v7mr1713031qev.58.1381392591023; Thu, 10 Oct 2013 01:09:51 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.49.5.231 with SMTP id v7mr1713026qev.58.1381392590943; Thu, 10 Oct 2013 01:09:50 -0700 (PDT) Received: by 10.140.41.242 with HTTP; Thu, 10 Oct 2013 01:09:50 -0700 (PDT) In-Reply-To: References: Date: Thu, 10 Oct 2013 09:09:50 +0100 Message-ID: From: David House To: David Allsopp Cc: OCaml List Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] exhaustiveness checking within a submatch This does actually work with polymorphic variants, as long as you rename the thing in the submatch: match f with `A -> 1 | `B -> 2 | (`C | `D as foo) -> match foo with `C -> 3 | `D -> 4 On 10 October 2013 09:07, David Allsopp wrote: > Martin DeMello wrote: >> Just curious as to why the compiler can't handle this, since in theory >> everything is statically deducible: >> >> # type test = A | B | C | D;; >> type test = A | B | C | D >> >> # let f = A;; >> val f : test = A >> >> # match f with A -> 1 | B -> 2 | C | D -> ( match f with C -> 3 | D -> >> 4);; >> Characters 40-71: >> Warning >> 8: this pattern-matching is not exhaustive. >> Here is an >> example of a value that is not matched: >> (A|B) >> Characters 40-71: >> Warning 8: this pattern-matching is not exhaustive. >> Here is an example of a value that is not matched: >> (A|B) >> - : int = 1 > > http://caml.inria.fr/pub/ml-archives/caml-list/2007/02/d35648b13d76f1717edbf41101dc913f.en.html > > > David > > -- > 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