On Wed, Nov 4, 2015 at 9:10 PM, Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> wrote:the code you wrote is exactly equivalent to:
include (((module type of M) with type t = M.t) with type u = M.u)And the parentheses here don't matter right, so this is the same as:include module type of Mwith type t = M.twith type u = M.uSo then why do we have the "and" syntax at all?Well, I can use manifest types to work around this, at the expense of some manual typing. Here's what works:$ cat foo.mlmodule M = structtype t = A | B of uand u = C of tendmodule N : sigtype t = M.t = A | B of uand u = M.u = C of tval f : t -> tend = structtype t = M.t = A | B of uand u = M.u = C of tlet f x = xendlet x : M.t = M.Alet _ = N.f x