Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] using arguments insides functors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <rossberg@p...>
Subject: Re: [Caml-list] using arguments insides functors
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?


	- Andreas

Andreas Rossberg,

Let's get rid of those possible thingies!  -- TB

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: