Browse thread
Type visibility limitation in recursive modules
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Márk_S._Zoltán <zoltan.s.mark@d...> |
| Subject: | Type visibility limitation in recursive modules |
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-