Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: bob zhang <bobzhang1988@gmail.com>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: Caml List <caml-list@inria.fr>
Subject: [Caml-list] A problem about polymorphism variant
Date: Sat, 20 Oct 2012 21:59:10 -0400	[thread overview]
Message-ID: <CANcqPu7yAw6My8htudU11Xc+T7z==+rfVfYrSmQuBfJfHnGeoQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

Dear Jacques:
    I was reading the manual of chap4, it says
*tag-spec-full*::=`*tag-name<http://www.askra.de/software/ocaml-doc/4.00/manual011.html#tag-name>
*  [ of *typexpr<http://www.askra.de/software/ocaml-doc/4.00/types.html#typexpr>
* ]  { & *typexpr<http://www.askra.de/software/ocaml-doc/4.00/types.html#typexpr>
* }   ∣ *typexpr<http://www.askra.de/software/ocaml-doc/4.00/types.html#typexpr>
*

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

    I managed to make a working example:


          type 'a ab = [< `a|`b] as 'a ;;
          type 'a ac = 'a constraint 'a = [< `a | `c ]
          type ('a,'b) m = [< `m of 'a ab & 'a ac ] as 'b;;
          let u : ('a,'b) m = `m `a;;
          (* val u : ([ `a ], [ `m of [ `a ] ab ]) m = `m `a *)

   But still don't understand its use case, can you explain a bit about
this?

Many thanks
-- 
Regards
-- Bob

[-- Attachment #2: Type: text/html, Size: 2270 bytes --]

                 reply	other threads:[~2012-10-21  1:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANcqPu7yAw6My8htudU11Xc+T7z==+rfVfYrSmQuBfJfHnGeoQ@mail.gmail.com' \
    --to=bobzhang1988@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox