From: Jacques Carette <carette@mcmaster.ca>
To: Dario Teixeira <darioteixeira@yahoo.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Private types in 3.11, again
Date: Tue, 20 Jan 2009 12:29:48 -0500 [thread overview]
Message-ID: <49760A0C.5080204@mcmaster.ca> (raw)
In-Reply-To: <865755.99476.qm@web111508.mail.gq1.yahoo.com>
Hmmm, a variant of your code may be exhibiting a bug in ocaml 3.11.0.
In your signature, change the +'a t signature to
type +'a t = private [< elem_t ]
and remove all annotations from the definition of sprint2. Then, as
defined, one gets the error message
File "bug2.ml", line 26, characters 0-223:
Error: Signature mismatch:
Modules do not match:
sig
val sprint2 :
([< `Bold of 'a list | `Text of string ] as 'a) -> string
end
is not included in
sig val sprint2 : 'a Node.t -> string end
Values do not match:
val sprint2 :
([< `Bold of 'a list | `Text of string ] as 'a) -> string
is not included in
val sprint2 : 'a Node.t -> string
which is not very informative, especially since expanding 'a Node.t
gives exactly what the compiler reports as the first argument of sprint2.
To coax the compiler to be more helpful, on places the definition of
sprint2 outside a module (but still in the same file as Node), and
instead the result is:
File "bug2.ml", line 30, characters 26-29:
Error: This expression has type Node.elem_t list but is here used with type
'a Node.t list
Type Node.elem_t = [ `Bold of Node.elem_t list | `Text of string ]
is not compatible with type
'a Node.t = [< `Bold of Node.elem_t list | `Text of string ]
Types for tag `Text are incompatible
[That point to the seq in List.map sprintf2 seq]. Here is where the
potential bug is: how is string incompatible with string?
[If this is a bug, I'll add it to the database]
Jacques
next prev parent reply other threads:[~2009-01-20 17:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 17:31 Dario Teixeira
2009-01-19 15:09 ` [Caml-list] " Dario Teixeira
2009-01-20 16:33 ` Dario Teixeira
2009-01-20 17:29 ` Jacques Carette [this message]
2009-01-20 17:48 ` Dario Teixeira
2009-01-21 10:48 ` Jacques Garrigue
2009-01-21 10:38 ` Jacques Garrigue
2009-01-21 13:22 ` Jacques Garrigue
2009-01-21 19:11 ` Dario Teixeira
2009-01-21 20:17 ` Gabriel Kerneis
2009-01-21 21:52 ` GADTs in Ocaml (was: Private types in 3.11, again) Dario Teixeira
2009-01-22 1:36 ` [Caml-list] Private types in 3.11, again Jacques Garrigue
2009-01-26 15:13 Dario Teixeira
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=49760A0C.5080204@mcmaster.ca \
--to=carette@mcmaster.ca \
--cc=caml-list@yquem.inria.fr \
--cc=darioteixeira@yahoo.com \
/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