Version française
Home     About     Download     Resources     Contact us    
Browse thread
question about "with module"
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stephen Weeks <sweeks@s...>
Subject: question about "with module"
Why does this program typecheck?

------------------------------------------------------------
module type S = sig
  module A : sig
    val x : int
  end
  module Z : sig
    module B : sig
    end
  end with module B = A
end

module F (S : S) = struct let _ = S.Z.B.x end
------------------------------------------------------------

The explanation of "with module" in the manual:

  http://caml.inria.fr/pub/docs/manual-ocaml/manual018.html

says:

  The constraint module module-path = extended-module-path adds type equations
  to all type components of the sub-structure denoted by module-path, making
  them equivalent to the corresponding type components of the structure denoted
  by extended-module-path.

It doesn't say anything about adding value components.