caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* functor troubles
@ 2008-03-03 15:40 Sam Steingold
  2008-03-03 17:15 ` [Caml-list] " Keiko Nakata
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Steingold @ 2008-03-03 15:40 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] functor troubles
  2008-03-03 15:40 functor troubles Sam Steingold
@ 2008-03-03 17:15 ` Keiko Nakata
  0 siblings, 0 replies; 2+ messages in thread
From: Keiko Nakata @ 2008-03-03 17:15 UTC (permalink / raw)
  To: sds; +Cc: caml-list

Hello,

the following thread may be useful to you

http://caml.inria.fr/pub/ml-archives/caml-list/2007/03/80072743d454a8cdc79cb67c110586b0.en.html

With best regards,
Keiko


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-03 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-03 15:40 functor troubles Sam Steingold
2008-03-03 17:15 ` [Caml-list] " Keiko Nakata

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