Browse thread
type aliases and recursive modules
- Josh Berdine
[
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: | Josh Berdine <berdine@d...> |
| Subject: | type aliases and recursive modules |
Hi,
There's something I'm not understanding about recursive modules. Consider
the following distilled example:
#
module rec A : sig
type t = It of ASet.t
val compare : t -> t -> int
val get : t -> ASet.t
end = struct
type t = It of ASet.t
let compare = compare
let get = function It(x) -> x
end
and ASet : sig
type t
val get_its_elements : t -> A.t list
end = struct
module C = Set.Make(A)
type t = C.t
let get_its_elements x = C.elements (A.get x)
end
;;
Characters 350-359:
let get_its_elements x = C.elements (A.get x)
^^^^^^^^^
This expression has type ASet.t but is here used with type
C.t = Set.Make(A).t
#
Why doesn't the typechecker know that ASet.t and C.t are the same type?
Anyone know a workaround?
This is with the 3.10.0 beta version, but seems to be the same back to 3.07.
Cheers, Josh