From: "Jacques Le Normand" <rathereasy@gmail.com>
To: "caml-list caml-list" <caml-list@yquem.inria.fr>
Subject: question about polymorphic variants
Date: Fri, 2 May 2008 13:35:35 -0400 [thread overview]
Message-ID: <f74178430805021035h60296fc7l133c23a222e41260@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 798 bytes --]
Hello caml-list,
when I try to run the following code:
type sometype =
([
`Foo of int
| `Bar of int
| `Var of 'a ref
] as 'a)
type someother =
([
`Foo of int
| `Var of 'a ref
] as 'a)
let foo : someother = `Foo 5;;
(foo :> sometype)
in my ocaml repl, it gives me the following error
This expression cannot be coerced to type
sometype = [ `Bar of int | `Foo of int | `Var of sometype ref ];
it has type someother = [ `Foo of int | `Var of someother ref ]
but is here used with type
[< sometype ] = [< `Foo of int | `Var of sometype ref ]
Type someother = [ `Foo of int | `Var of someother ref ]
is not compatible with type
sometype = [ `Bar of int | `Foo of int | `Var of sometype ref ]
The first variant type does not allow tag(s) `Bar
how do I get around this?
[-- Attachment #2: Type: text/html, Size: 1014 bytes --]
next reply other threads:[~2008-05-02 17:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-02 17:35 Jacques Le Normand [this message]
2008-05-02 18:03 ` Rémi Vanicat
-- strict thread matches above, loose matches on Subject: below --
2005-10-28 9:57 Question " Xavier Clerc
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=f74178430805021035h60296fc7l133c23a222e41260@mail.gmail.com \
--to=rathereasy@gmail.com \
--cc=caml-list@yquem.inria.fr \
/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