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 7542F81799 for ; Fri, 26 Jul 2013 23:25:17 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=212.27.42.3; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=212.27.42.3; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp3-g21.free.fr) identity=helo; client-ip=212.27.42.3; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@smtp3-g21.free.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhcBAA7o8lHUGyoDlGdsb2JhbABBGoM7vi6BGRYOAQEBAQcNCQkUAyWCJAEBBThAARALGAkWDwkDAgECAUUGDQEHAQGIEAgzuEiPfQeEBQOXX4EphHqOPw X-IPAS-Result: AhcBAA7o8lHUGyoDlGdsb2JhbABBGoM7vi6BGRYOAQEBAQcNCQkUAyWCJAEBBThAARALGAkWDwkDAgECAUUGDQEHAQGIEAgzuEiPfQeEBQOXX4EphHqOPw X-IronPort-AV: E=Sophos;i="4.89,753,1367964000"; d="scan'208";a="27464915" Received: from smtp3-g21.free.fr ([212.27.42.3]) by mail2-smtp-roc.national.inria.fr with ESMTP; 26 Jul 2013 23:25:16 +0200 Received: from [192.168.0.10] (unknown [78.192.0.38]) by smtp3-g21.free.fr (Postfix) with ESMTP id 66D96A6228; Fri, 26 Jul 2013 23:25:12 +0200 (CEST) Message-ID: <51F2E937.7000809@frisch.fr> Date: Fri, 26 Jul 2013 23:25:11 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Gabriel Scherer CC: Mathieu Barbin , caml-list@inria.fr References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] GADT: question about inference On 7/26/2013 10:27 PM, Gabriel Scherer wrote: > This is explained in the manual (emphasis mine) > http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#toc85 > >> The constraints associated to each constructor can be recovered through pattern-matching. >> Namely, **if the type of the scrutinee of a pattern-matching contains a locally abstract type**, >> this type can be refined according to the constructor used. > > The only types that can be refined by the type equalities introduced > by GADT are locally abstract types, the variable-like constructor "a" > introduced by the "(type a)" and "foo : type a . bar" syntaxes. Your > first two examples have no locally abstract type, only type members of > modules, so there was no GADT refinement happening. A feature request related to allowing more kinds of types to be refined by GADT patterns (abstract types in the current environment, introduced by unpacking a module -- but the same would be useful for abstract types in a functor's argument): http://caml.inria.fr/mantis/view.php?id=5713 -- Alain