From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 3F3517EC41 for ; Sun, 21 Oct 2012 03:59:12 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of bobzhang1988@gmail.com) identity=pra; client-ip=209.85.210.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of bobzhang1988@gmail.com designates 209.85.210.182 as permitted sender) identity=mailfrom; client-ip=209.85.210.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ia0-f182.google.com) identity=helo; client-ip=209.85.210.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="postmaster@mail-ia0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhQCADlWg1DRVdK2m2dsb2JhbABEDoYGunMIIwEBAQEBCAkLCRQngjkCDx0BGx0BAxIDBgc3AiQBEQEFASI1h08BAw8LnHoJA4tZT4J2hAgKGScNWYh1AQUMkTCBEgOVcY5YFimDVFk X-IronPort-AV: E=Sophos;i="4.80,622,1344204000"; d="scan'208,217";a="178164832" Received: from mail-ia0-f182.google.com ([209.85.210.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 21 Oct 2012 03:59:11 +0200 Received: by mail-ia0-f182.google.com with SMTP id k10so2199661iag.27 for ; Sat, 20 Oct 2012 18:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=5CvB2DP3FM5ddq6zJMn2n8Zk7CXNPhcFMvSe0M2To5o=; b=S9ivXoKu3pQfbyvHK6nHyACg3xnjWKindtsqJgSitorLFZtBMaVh6Qt3t87qceKbOv dvQnB33y7K6YYI7xGfHB62IwzneFbWtEqkw3BqIIHuyEihqwfnKXOpQilMB12CPEdNzA 1MiLOSyR4LDyp6BHT3qkl89kS7NfKWhHvtUoFud5GOYb0ufSi7Qn2KGcAFno9IGuLo49 d9UTDA0swytjh9Cz2JjXIPUyGZDj2fHKepRTpQ+mLT5AGcsAJl7yzqTyQqlgZ0ZrCM/R Siy8cHc6Ninl1TpM7eqgOlPyuW4bWMzc9f8IPwafU67l9ENzk8OrQxsHalDZq6E0ex0Q uWwA== MIME-Version: 1.0 Received: by 10.42.52.5 with SMTP id h5mr4665334icg.50.1350784750174; Sat, 20 Oct 2012 18:59:10 -0700 (PDT) Received: by 10.64.17.4 with HTTP; Sat, 20 Oct 2012 18:59:10 -0700 (PDT) Date: Sat, 20 Oct 2012 21:59:10 -0400 Message-ID: From: bob zhang To: Jacques Garrigue Cc: Caml List Content-Type: multipart/alternative; boundary=485b397dd1c933c1df04cc881534 Subject: [Caml-list] A problem about polymorphism variant --485b397dd1c933c1df04cc881534 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Dear Jacques: I was reading the manual of chap4, it says *tag-spec-full*::=3D`*tag-name * [ of *typexpr * ] { & *typexpr * } =E2=88=A3 *typexpr * I don't follow the (&) operation here, it means intersection types ? I managed to make a working example: type 'a ab =3D [< `a|`b] as 'a ;; type 'a ac =3D 'a constraint 'a =3D [< `a | `c ] type ('a,'b) m =3D [< `m of 'a ab & 'a ac ] as 'b;; let u : ('a,'b) m =3D `m `a;; (* val u : ([ `a ], [ `m of [ `a ] ab ]) m =3D `m `a *) But still don't understand its use case, can you explain a bit about this? Many thanks --=20 Regards -- Bob --485b397dd1c933c1df04cc881534 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Dear Jacques:
=C2=A0 =C2=A0 I was reading = the manual of chap4, it says
tag-spec-full ::=3D`= tag-name=C2=A0=C2=A0[=C2=A0of=C2=A0typexpr=C2=A0]=C2=A0=C2=A0{=C2=A0<= font color=3D"blue">&=C2=A0typexpr=C2=A0} =C2=A0<= /td>
=C2=A0= =E2=88=A3=C2=A0typexpr=C2=A0

=C2=A0 = =C2=A0 I don't follow the (&) operation here, it means intersection= types ?

=C2=A0 =C2=A0 I managed to make a working= example:


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 type = 'a ab =3D [< `a|`b] as 'a ;;
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 type 'a ac =3D 'a constraint 'a =3D [< `a | `c ]<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 type ('a,'b) m =3D [&l= t; `m of 'a ab & 'a ac ] as 'b;;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 let u : ('a,'b) m =3D `m `a= ;;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (* val u : ([ `a ], [ `m of= [ `a ] ab ]) m =3D `m `a *)

=C2=A0 =C2=A0Bu= t still don't understand its use case, can you explain a bit about this= ?

Many thanks
--
Regards
-- Bob
--485b397dd1c933c1df04cc881534--