Version française
Home     About     Download     Resources     Contact us    
Browse thread
Recursive modules and variance
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeremy Yallop <jeremy.yallop@e...>
Subject: Recursive modules and variance
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.