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 AC84C7FD90 for ; Thu, 15 Dec 2016 15:12:59 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.mayr@mail.de; spf=Pass smtp.mailfrom=gabriel.mayr@mail.de; spf=None smtp.helo=postmaster@shout02.mail.de Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.mayr@mail.de) identity=pra; client-ip=213.128.151.217; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.mayr@mail.de"; x-sender="gabriel.mayr@mail.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.mayr@mail.de designates 213.128.151.217 as permitted sender) identity=mailfrom; client-ip=213.128.151.217; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.mayr@mail.de"; x-sender="gabriel.mayr@mail.de"; 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@shout02.mail.de) identity=helo; client-ip=213.128.151.217; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.mayr@mail.de"; x-sender="postmaster@shout02.mail.de"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AeIJdvRNayMXCEybiJJMl6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0K/v5rarrMEGX3/hxlliBBdydsKMfzbSG+Pq8ESxYuNDa7yBEKMQNHzY+yu?= =?us-ascii?q?wo3CUYSPafDkP6KPO4JwcbJ+9lEGFfwnegLEJOE9z/bVCB6le77DoVBwmtfVEt?= =?us-ascii?q?fre9ScbuiJG83uW2vpnSeBlghTynYLo0Ig/lgx/Ws5w5iIF4K6s1gj7As2EAL+?= =?us-ascii?q?tfz3lpKFbVmh/t/O+19Z9ntShd7aFyv/VcWLn3KvxrBYdTCy4rZjg4?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CpAAB+pFJYgNmXgNVdHRgHDBgHgwABA?= =?us-ascii?q?QEBAXmBBoR2iUuiRYoxIoYAggZDEAEBAQEBAQEBAQEBEgEBCwsJCRsygjMYgkc?= =?us-ascii?q?EGQEBOBQKARwhAhFCMIg/AQMbAahlaIFsPIMMAQEFg1kSOBWDbgiGNoIFhSiCG?= =?us-ascii?q?R+COC2CMIhokgmBeYRYilQNgkWHUgWGL5IjNlFQhhg9NIg4AQEB?= X-IPAS-Result: =?us-ascii?q?A0CpAAB+pFJYgNmXgNVdHRgHDBgHgwABAQEBAXmBBoR2iUu?= =?us-ascii?q?iRYoxIoYAggZDEAEBAQEBAQEBAQEBEgEBCwsJCRsygjMYgkcEGQEBOBQKARwhA?= =?us-ascii?q?hFCMIg/AQMbAahlaIFsPIMMAQEFg1kSOBWDbgiGNoIFhSiCGR+COC2CMIhokgm?= =?us-ascii?q?BeYRYilQNgkWHUgWGL5IjNlFQhhg9NIg4AQEB?= X-IronPort-AV: E=Sophos;i="5.33,352,1477954800"; d="scan'208,217";a="250229154" Received: from shout02.mail.de ([213.128.151.217]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Dec 2016 15:12:41 +0100 Received: from postfix03.mail.de (postfix03.bt.mail.de [10.0.121.127]) by shout02.mail.de (Postfix) with ESMTP id 3B2145FF9D for ; Thu, 15 Dec 2016 15:12:40 +0100 (CET) Received: from smtp03.mail.de (smtp03.bt.mail.de [10.0.121.213]) by postfix03.mail.de (Postfix) with ESMTP id 2455E40020 for ; Thu, 15 Dec 2016 15:12:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde201610; t=1481811160; bh=UNprWoFKzBFovhYnxFgMX1B+XhqJ7fhjmAFiaJcRWfA=; h=From:To:Subject:Date:From; b=iCl2jE08ykebIXhoeFRGQSgQ2uLr4yzF3l7N8dgVi1PBmPQDuH+Y6b9bWwyw/lAuJ RkYJh9JlP0JQ4QIYk+nZT5R1Uy0Cze0UoX49N5cbILhY9+KhDFKlnQUt7iyqgoS6Ep snN+d0aODVMcTaB7lwpl6U0W7CRsawO5MkBGFVlY= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp03.mail.de (Postfix) with ESMTPSA id 01BE740092 for ; Thu, 15 Dec 2016 15:12:39 +0100 (CET) From: Gabriel Mayr To: caml-list@inria.fr X-Priority: 3 Date: Thu, 15 Dec 2016 15:12:39 +0100 Content-Type: multipart/alternative; boundary="=_f27f2dbe59c20f0c64086606bdaa81bf" MIME-Version: 1.0 Message-Id: <20161215141240.01BE740092@smtp03.mail.de> X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 2814 X-purgate-ID: 154282::1481811160-0000085D-AB813875/0/0 X-Validation-by: gabriel.mayr@mail.de Subject: [Caml-list] unnamed records in match on multiple constructors --=_f27f2dbe59c20f0c64086606bdaa81bf Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I'm using utop version 1.19.3 (using OCaml version 4.03.0). Using a= n NAMED record in a type definition and afterwards match on multiple constr= uctors WORKS: # type a =3D {i:int};; #type t =3D A of a | B of a;; # let x= =3D A {i=3D10};; # match x with | A e | B e -> print_int e.i;; Using an UNNAMED record in a type defin= ition and afterwards match on multiple constructors DOES NOT WORK: # type t= =3D A of {i:int} | B of {i:int};; # let x =3D A {i=3D10};; # match x with | A e | B e -> print_int e.i;;=20 "Error: The variable e on the left-hand side of this or-pattern has type t.= A but on the right-hand side it has type t.B" I don't know if this is= behaviour of OCaml is desired or it's a fault. Hope I could help you wit= h this little hint. Best regards, Gabriel ---------------------------------------------------------------------------= ---------------------- FreeMail powered by mail.de - MEHR SICHERHEIT, SERIOSIT=C3=84T UND KOMFORT --=_f27f2dbe59c20f0c64086606bdaa81bf Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
 
Hi,
 
I'm using utop version 1.19.3 (using OCaml version 4.03.0).
 
Using an named record in a type definition and afterw= ards match on multiple constructors works:
# type a =3D {i:int};;
#type t =3D A of a | B of a;;
# let x =3D A {i=3D10};;
# match x with
| A e | B e -> print_int e.i;;
 
 
Using an unnamed record in a type definition and afte= rwards match on multiple constructors does not work:
# type t =3D A of {i:int} | B of {i:int};;
# let x =3D A {i=3D10};;
# match x with
| A e | B e -> print_int e.i;;

"Error: The variable e on the left-hand side of this or-pattern = has type t.A but on the right-hand side it has type t.B"
 
 
 
I don't know if this is behaviour of OCaml is desired or it's a fault.=
 
Hope I could help you with this little hint.
 
Best regards,
 
Gabriel


FreeMail powered by mail.de - mehr Sicherheit, Seriosit=C3=A4t un= d Komfort --=_f27f2dbe59c20f0c64086606bdaa81bf--