caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Recursive modules and variance
@ 2008-06-26 19:54 Jeremy Yallop
  0 siblings, 0 replies; only message in thread
From: Jeremy Yallop @ 2008-06-26 19:54 UTC (permalink / raw)
  To: caml users

Should variance annotations be visible to modules in the same recursive 
group?

The following program is accepted by OCaml 3.10.2

        module M : sig type +'a t end =
                struct type +'a t end
        module N : sig type +'a t = 'a M.t end =
                struct type +'a t = 'a M.t end

but the following program is rejected

    module rec M : sig type +'a t end =
                struct type +'a t end
           and N : sig type +'a t = 'a M.t end =
                struct type +'a t = 'a M.t end

with the message

    "In this definition, expected parameter variances are not satisfied.
     The 1st type parameter was expected to be covariant,
     but it is invariant"

Jeremy.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-26 19:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-26 19:54 Recursive modules and variance Jeremy Yallop

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