From: Polux Moon <polux.moon@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] ICFP 2011: Call for participation
Date: Tue, 26 Jul 2011 12:47:30 +0200 [thread overview]
Message-ID: <CANGFCiBdpvVQ5ZmgXSQz1KQF133LqnW70O6rHcx2mjMyoEdmNA@mail.gmail.com> (raw)
In-Reply-To: <CAAmpXij1SsvpgNJ7B63sg+kFuapED32piUvZ5xGrjAQ+ucwrnA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 649 bytes --]
Hi,
I have a type error on code similar to :
-----
type 'par t = 'par
let ident v = v
class alias =
object
method alias : 'a . 'a t -> 'a = ident (* type error here *)
end
-----
Which gives :
-----
Error: This expression has type 'a. 'a t -> 'a
but an expression was expected of type 'b. 'b t -> 'b
Type 'a a = 'a is not compatible with type 'b t = 'b
-----
The problem is related to unification of foralls containing named type in a
method.
The compiler accepts equivalent code when not using the named type "t" or
when not using a method (see attached file).
Is it a [known] limitation ? Is there a way to work around it ?
[-- Attachment #1.2: Type: text/html, Size: 817 bytes --]
[-- Attachment #2: forallclass.ml --]
[-- Type: text/x-ocaml, Size: 300 bytes --]
type 'par t = 'par
let ident v = v (* here adding : 'a . 'a a -> 'a changes nothing *)
class alias =
object
method alias : 'a . 'a t -> 'a = ident (* NOT OK *)
end
(* but *)
let alias : 'a . 'a t -> 'a = ident (* OK *)
type r = { alias : 'a . 'a t -> 'a}
let alias = { alias = ident } (* OK *)
prev parent reply other threads:[~2011-07-26 10:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 8:57 Wouter Swierstra
2011-07-26 10:47 ` Polux Moon [this message]
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=CANGFCiBdpvVQ5ZmgXSQz1KQF133LqnW70O6rHcx2mjMyoEdmNA@mail.gmail.com \
--to=polux.moon@gmail.com \
--cc=caml-list@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