* [Caml-list] using arguments insides functors @ 2004-08-03 11:50 nakata keiko 2004-08-03 12:42 ` Andreas Rossberg 0 siblings, 1 reply; 3+ messages in thread From: nakata keiko @ 2004-08-03 11:50 UTC (permalink / raw) To: caml-list Hello, why the following code does not get type checked ? module type I = sig module type T end module F = functor (Elt : I) -> struct module type T = Elt.T module F = functor (Elt : T) -> struct include Elt end end Thanks, Keiko ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] using arguments insides functors 2004-08-03 11:50 [Caml-list] using arguments insides functors nakata keiko @ 2004-08-03 12:42 ` Andreas Rossberg 2004-08-03 13:01 ` nakata keiko 0 siblings, 1 reply; 3+ messages in thread From: Andreas Rossberg @ 2004-08-03 12:42 UTC (permalink / raw) To: caml-list nakata keiko wrote: > why the following code does not get type checked ? > > module type I = > sig > module type T > end > > module F = functor (Elt : I) -> > struct > module type T = Elt.T > module F = functor (Elt : T) -> > struct > include Elt > end > end Because "include" only applies to modules that are structures, since it is meant to copy its fields to the current scope. In your example however, Elt has some abstract module type T, so it does not meet that requirement. What should the include mean if you applied the outer F like F (struct module type T = functor (X : sig end) -> sig end end) ? And how could you express the result type of F without knowing the structure of Elt? Cheers, - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de Let's get rid of those possible thingies! -- TB ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] using arguments insides functors 2004-08-03 12:42 ` Andreas Rossberg @ 2004-08-03 13:01 ` nakata keiko 0 siblings, 0 replies; 3+ messages in thread From: nakata keiko @ 2004-08-03 13:01 UTC (permalink / raw) To: rossberg; +Cc: caml-list, keiko > Because "include" only applies to modules that are structures, since it > is meant to copy its fields to the current scope. In your example > however, Elt has some abstract module type T, so it does not meet that > requirement. What should the include mean if you applied the outer F like > > F (struct module type T = functor (X : sig end) -> sig end end) > > ? And how could you express the result type of F without knowing the > structure of Elt? > > Cheers, > > - Andreas > Mm-hm, I see. Thank you. Keiko ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-08-03 13:01 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-08-03 11:50 [Caml-list] using arguments insides functors nakata keiko 2004-08-03 12:42 ` Andreas Rossberg 2004-08-03 13:01 ` nakata keiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox