* [Caml-list] A problem about polymorphism variant
@ 2012-10-21 1:59 bob zhang
0 siblings, 0 replies; only message in thread
From: bob zhang @ 2012-10-21 1:59 UTC (permalink / raw)
To: Jacques Garrigue; +Cc: Caml List
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-10-21 1:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-21 1:59 [Caml-list] A problem about polymorphism variant bob zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox