Version française
Home     About     Download     Resources     Contact us    
Browse thread
functor troubles
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sam Steingold <sds@g...>
Subject: functor troubles
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It appears that module functor arguments are needlessly duplicated:

============================================
module A1 = struct
~  module F (M: sig end) = struct
~    type t = T
~  end
~  module I = struct end
~  module M = F (I)
end

module A2 = A1

let f : A1.M.t -> A2.M.t = fun x -> x
============================================

This expression has type A1.M.t = A1.F(A1.I).t but is here used with
type A2.M.t = A1.F(A2.I).t

when I replace "module M = F (I)" with "module M = F (struct end)" it works.

Note that the whole file invokes the functor F precisely once, so it is
not clear why type A2.M.t is defined in terms of F and not as identical
to A1.M.t.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHzBvmPp1Qsf2qnMcRApMkAJ9OJEfpRk1eKxce3HsZfHapqKKnwQCglT04
ZNXh7XxnQRwz1XjZzTO9wnI=
=3TuW
-----END PGP SIGNATURE-----