caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Manifest types in module type inclusions
@ 2010-12-26  5:19 Markus Mottl
  2010-12-26  5:56 ` Jacques Garrigue
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Mottl @ 2010-12-26  5:19 UTC (permalink / raw)
  To: OCaml List

Hi,

please consider the following code:

-------------------
module M = struct type t = A | B end

module X : sig
(*  type t = M.t = A | B *)
  include module type of M
(*  include module type of M with type t = M.t = A | B *)
end = struct include M end

let () = assert (M.A = X.A)
-------------------

This will fail, because M.A is not of the same type as X.A.  But I
would really like to make the types equivalent.

Using the first commented out line instead of the module type
inclusion will succeed, but then I would not be able to automatically
include any functions potentially contained in module M.  The last
commented out line won't work, because one cannot establish a type
equivalence via a manifest type definition after "with type".  Even
if, I don't think one could override anything else but an abstract
type that way, and we are including a sum type here already.

Does anybody have any suggestions for a workaround?  I suspect this
may be a missing feature.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


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

end of thread, other threads:[~2010-12-26  5:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-26  5:19 [Caml-list] Manifest types in module type inclusions Markus Mottl
2010-12-26  5:56 ` Jacques Garrigue

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).