caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Type visibility limitation in recursive modules
@ 2007-12-23 14:24 "Márk S. Zoltán"
  2007-12-23 17:20 ` [Caml-list] " Peng Zang
  2007-12-24 11:44 ` "Márk S. Zoltán"
  0 siblings, 2 replies; 8+ messages in thread
From: "Márk S. Zoltán" @ 2007-12-23 14:24 UTC (permalink / raw)
  To: caml-list

Behold the following code snippet:

module rec Aleph :
    sig
        type t = Tag of Beth.t
    end =
    struct
        type t = Tag of Beth.t
    end
and Beth :
    sig
        type t
        val scandalous : Aleph.t
    end =
    struct
        type t = Aleph.t list
        let scandalous = Aleph.Tag((* HERE BE DRAGONS *) [])
    end

The compiler complains that the empty list after HERE BE DRAGONS has 
type 'a list but it is used with type Beth.t. I'd expect the compiler to 
discover that those types can be unified via 'a == Aleph.t, since as far 
as I can tell, all necessary facts are visible at that point. Replacing 
"Beth : sig type t ..." with "Beth : sig type t = Aleph.t list ..." does 
away with the error, but I would very much like to keep Beth.t an opaque 
type. Is this an intended behavior? And if it is intended, is there a 
way to tell the compiler what I really want it to do?

Thanks in advance for any help.

    Z-


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-12-28 13:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-23 14:24 Type visibility limitation in recursive modules "Márk S. Zoltán"
2007-12-23 17:20 ` [Caml-list] " Peng Zang
2007-12-23 18:00   ` "Márk S. Zoltán"
2007-12-24 11:44 ` "Márk S. Zoltán"
2007-12-27 23:13   ` "Márk S. Zoltán"
2007-12-28 10:02     ` Keiko Nakata
2007-12-28 12:46       ` "Márk S. Zoltán"
2007-12-28 13:42         ` Keiko Nakata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).