From: Samuel Mimram <samuel.mimram@ens-lyon.org>
To: caml-list@yquem.inria.fr
Subject: Objects and variants
Date: Fri, 06 Mar 2009 16:57:43 +0100 [thread overview]
Message-ID: <49B147F7.4090303@ens-lyon.org> (raw)
Hi,
When I try to compile the following code:
class a =
object
method f (x:[>]) = ()
end
I get the following error:
Error: Some type variables are unbound in this type:
class a : object method f : [> ] -> unit end
The method f has type ([> ] as 'a) -> unit where 'a is unbound
Is the binding of [>] to 'a really necessary here? In particular it is
not mentioned in the inferred type...
Of course I can parametrize the class over 'a as
class ['a] a =
object
method f (x:[>] as 'a) = ()
end
which now has type
class ['a] a : object constraint 'a = [> ] method f : 'a -> unit end
But this seems rather cumbersome. Is there a way to handle this without
mentioning 'a?
Thanks!
Cheers,
Samuel.
next reply other threads:[~2009-03-06 15:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 15:57 Samuel Mimram [this message]
2009-03-06 16:10 ` [Caml-list] " Peng Zang
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=49B147F7.4090303@ens-lyon.org \
--to=samuel.mimram@ens-lyon.org \
--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