caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Module type of a structure returned by functor
@ 2010-04-23 23:14 Dawid Toton
  2010-04-26 16:33 ` Dawid Toton
  2010-04-27  0:23 ` [Caml-list] " Jacques Garrigue
  0 siblings, 2 replies; 5+ messages in thread
From: Dawid Toton @ 2010-04-23 23:14 UTC (permalink / raw)
  To: caml-list

1. The following piece of code contains illegal constructs. These are 
functor applications marked with (* ? *).
     Basically, I need module type of what is produced by functor.
     My first question is: what is the proper, "canonical" workaround 
for unavailability of applications marked (* ? *) ?

module type Big = sig type t type u end
module type Small = sig type t end

module type MakeEdge = functor (Big : Big) -> sig val foo : Big.t option end
module MakeEdge = functor (Big : Big) -> struct let foo = None end

module type Add_boilerplate = functor (Small:Small) -> sig type t end
module Add_boilerplate = functor (Small:Small) -> struct type t = 
Small.t type u = t end

module type ConvenientEdge = functor (Small:Small) -> MakeEdge 
(Add_boilerplate (Small)) (* ? *)
module ConvenientEdge = functor (Small:Small) -> MakeEdge 
(Add_boilerplate (Small))

module SmallX = struct type t = int end
module EdgeX = ConvenientEdge (SmallX)
module type EdgeX = ConvenientEdge (SmallX) (* ? *)

module Algorithm = functor (EdgeX : EdgeX) -> struct let doit = 
EdgeX.foo end


2. And the related question: why one can't do functor applications in 
module types as in above lines marked with (* ? *) ? Is there some 
theoretical reason?

3. Will the "module type of..." feature of 3.12 help with this? I can 
imagine e.g.:

module type EdgeX = (module type of (ConvenientEdge (SmallX)))


Dawid


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

end of thread, other threads:[~2010-04-27  0:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-23 23:14 Module type of a structure returned by functor Dawid Toton
2010-04-26 16:33 ` Dawid Toton
2010-04-26 16:48   ` [Caml-list] " Vincent Aravantinos
2010-04-26 16:54   ` rossberg
2010-04-27  0:23 ` [Caml-list] " Jacques Garrigue

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