Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* type aliases and recursive modules
@ 2007-05-15 15:40 Josh Berdine
  2007-05-15 16:29 ` [Caml-list] " Philippe Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Berdine @ 2007-05-15 15:40 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 5825 bytes --]

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

end of thread, other threads:[~2007-05-15 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-15 15:40 type aliases and recursive modules Josh Berdine
2007-05-15 16:29 ` [Caml-list] " Philippe Wang
2007-05-15 16:56   ` Josh Berdine
2007-05-15 17:11     ` Philippe Wang
2007-05-15 17:40     ` Andreas Rossberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox