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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0C7277ED1D for ; Tue, 13 Oct 2015 08:10:09 +0200 (CEST) IronPort-PHdr: 9a23:dyEaGxwUegbQBF7XCy+O+j09IxM/srCxBDY+r6Qd0OoSIJqq85mqBkHD//Il1AaPBtWHraIewLCI6ujJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6OyZTtnLrsotX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD89pozcNLUL37cqIkVvQYSW1+ayFmrPHs4DDJQQKL4nIcGl4fnBRJDwnD4VmuV539uy/+v+o7wyCUM8z6TLY5cTun5qZvDhTvjXFUGSQ+9TT1g8dpka9A6D2ovQZ+zJPZKNWaPeBkf6zAcPsfTHZBGMBYWCtQC8ahKYIESegZa7UL57LhrkcD+EPtTTKnA/nin3oR3if7 Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=garrigue@math.nagoya-u.ac.jp; spf=None smtp.mailfrom=garrigue@math.nagoya-u.ac.jp; spf=None smtp.helo=postmaster@mailhost.math.nagoya-u.ac.jp Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=pra; client-ip=133.6.130.5; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of garrigue@math.nagoya-u.ac.jp) identity=mailfrom; client-ip=133.6.130.5; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="garrigue@math.nagoya-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mailhost.math.nagoya-u.ac.jp) identity=helo; client-ip=133.6.130.5; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="garrigue@math.nagoya-u.ac.jp"; x-sender="postmaster@mailhost.math.nagoya-u.ac.jp"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DyAQCcnxxWnAWCBoVdg3puv3gZgnqCCn8CgXcQAQEBAQEBAQEQAQEBAQEIFAlPgh+CCAEBBCcTBgMBNQEBDgsYHBJXBi6IEqt/hVwCihuEUgEBAQEBAQQBAQEBAQEBARMBBokFgm6EWjMHgxqBFI4IiBKFGYgBgVhIlXaDbziCPBYHFoFNYoZxAQEB X-IPAS-Result: A0DyAQCcnxxWnAWCBoVdg3puv3gZgnqCCn8CgXcQAQEBAQEBAQEQAQEBAQEIFAlPgh+CCAEBBCcTBgMBNQEBDgsYHBJXBi6IEqt/hVwCihuEUgEBAQEBAQQBAQEBAQEBARMBBokFgm6EWjMHgxqBFI4IiBKFGYgBgVhIlXaDbziCPBYHFoFNYoZxAQEB X-IronPort-AV: E=Sophos;i="5.17,676,1437429600"; d="scan'208";a="150348958" Received: from rabbit.math.nagoya-u.ac.jp (HELO mailhost.math.nagoya-u.ac.jp) ([133.6.130.5]) by mail3-smtp-sop.national.inria.fr with ESMTP; 13 Oct 2015 08:10:06 +0200 Received: from mailhost.math.nagoya-u.ac.jp (localhost [127.0.0.1]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id AF4E865E5; Tue, 13 Oct 2015 15:10:03 +0900 (JST) Received: from mailhost.math.nagoya-u.ac.jp (rabbit-172 [172.16.254.254]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTP id 1E2664148; Tue, 13 Oct 2015 15:10:03 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=math.nagoya-u.ac.jp; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=alpha; bh=tTMhpvnw4E66nCOuJob+pJ7VQz4=; b=lu1T3gIrieZkpJkPiJahF5QPRzv7 qKxdWm6Jxf2ufCoFyMx3bM9hQWcvM/B+HOsDp1xTeeiej7DIHCcBeSn3NgymfYG6 zBEMJm/FOsWnNVLcy4NDHmhaJik08ArnEhIq++kZ1HoYioWziOk0GiLH8KkrEPbS A0ZwKQjLvP4kq78= DomainKey-Signature: a=rsa-sha1; h=Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=cTZp+OfZwAajzNlmGHOKUNhZj2SucSkofgw3tVdro5uRBHWhz6ChO6Jte7876YLXSEFWkplDjAdtcCt+a+8OuW8GMuIQLemtBc4cDd51S9nPQpODdR7WYufVl7H+JW6lnjJVJ+uUisDj7iIi/yshwqVCthCTHFxhggHYNcbdSKM=; c=nofws; d=math.nagoya-u.ac.jp; q=dns; s=alpha Received: from tet.garrigue.jp (58x158x128x157.ap58.ftth.ucom.ne.jp [58.158.128.157]) by mailhost.math.nagoya-u.ac.jp (Postfix) with ESMTPSA id B31F36C74; Tue, 13 Oct 2015 15:08:58 +0900 (JST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) From: Jacques Garrigue In-Reply-To: Date: Tue, 13 Oct 2015 15:10:01 +0900 Cc: OCaML List Mailing Content-Transfer-Encoding: quoted-printable Message-Id: <57AB371C-5E6C-4F1F-BB35-2DB8F456CB8B@math.nagoya-u.ac.jp> References: To: Abdallah Saffidine X-Mailer: Apple Mail (2.2104) Subject: Re: [Caml-list] How to use GADTs across modules in OCaml without raising warnings? On 2015/10/13 14:27, Abdallah Saffidine wrote: >=20 > Hi all, >=20 > I am reposting this SO question. I suspect there might be a bug in the im= plementation of Warning 8. >=20 > Thanks, > Abdallah >=20 > I have two files: gadt1.ml and gadt2.ml and the second depends on the fir= st. >=20 > gadt1.ml: >=20 > type > never >=20 > type _ t1 =3D A1 : never t1 | B1 : > bool t1 >=20 > type _ t2 =3D A2 : string t2 | B2 : > bool t2 >=20 > let get1 : bool t1 -> bool =3D function B1 -> true > let get2 : bool t2 -> bool =3D function B2 -> true > gadt2.ml: >=20 > let get1 : bool Gadt1.t1 -> bool =3D function Gadt.B1 -> true > let get2 : bool Gadt1.t2 -> bool =3D function Gadt.B2 -> true > when I compile using ocaml 4.02.3 (ocamlbuild gadt2.native), I get a warn= ing 8 about the function Gadt2.get1 not being exhaustive. I am quite puzzle= d that Gadt2.get1 raises a warning while Gadt1.get1 and Gadt2.get2 don't. >=20 > My assumption was that the empty type never cannot be equal to bool so Ga= dt2.get1 should not raise a warning. On the other hand, if I call Gadt2.get= 1 with argument A1, I get a type error (as desired). Is the warning expecte= d behaviour or a bug? What did I miss? A explained by Stefan, abstract types coming from other modules cannot be p= roved distinct. Only predefined types such as string or array are handled specially. The simplest solution is to add a constructor to your type: type never =3D Never Better to do it when in the same module too. Jacques Garrigue=