Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] Definition of module synonyms
@ 2011-02-18  8:30 forum
  2011-02-18  9:10 ` Jacques Garrigue
  0 siblings, 1 reply; 4+ messages in thread
From: forum @ 2011-02-18  8:30 UTC (permalink / raw)
  To: caml-list users; +Cc: forum

Dear list,

Following the goal of providing module synonyms (e. g. abbreviations for lazy
developers), it seemed natural to do something along the following lines:

	module M : sig
	  type t = A
	  val x : t
	end = struct
	  type t = A
	  let x = A
	end
	module S : sig
	  type t = M.t = A
	  include module type of M with type t := M.t
	end = M

However, this is rejected with the following message:

	    include module type of M with type t := M.t
	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	Error: In this `with' constraint, the new definition of t
	       does not match its original definition in the constrained signature:
	       Type declarations do not match:
	         type t = M.t
	       is not included in
	         type t = A
	       Their kinds differ.

The very same problem arise when defining type "t" as a record, but not when
defining it as either an arrow type, or a polymorphic variant type. So my guess
is that I am missing something obvious about name scoping, but cannot just
get my finger on it.


Any insight would be greatly appreciated.


Regards,

Xavier Clerc



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

end of thread, other threads:[~2011-02-18 21:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18  8:30 [Caml-list] Definition of module synonyms forum
2011-02-18  9:10 ` Jacques Garrigue
2011-02-18  9:18   ` forum
2011-02-18 21:34   ` Norman Hardy

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