Version française
Home     About     Download     Resources     Contact us    
Browse thread
Type equalities in sub modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] Type equalities in sub modules
You seem to be looking for recursive modules, this might prove quite a
painful solution since you have to explicitly write the signature
(there's no type inference on recursive modules, this is a rather
complicated issue. Information can be found in [1])...:

module rec  M :
sig
 type t = int
  module B : sig type t = M.t end
end= struct
  type t = int
  module B = struct
    type mt = t
    type t = mt
  end
end;;

Happy new year,
Till
[1]:http://perso.ens-lyon.fr/tom.hirschowitz/
On 1/2/07, Hendrik Tews <H.Tews@cs.ru.nl> wrote:
> Daniel Bünzli <daniel.buenzli@epfl.ch> writes:
>
>    In the example below, is there any way to achieve M.B.t = M.t without
>    introducing the intermediate mt type ?
>
>    > module M = struct
>    >   type t = int
>    >   module B = struct
>    >     type mt = t
>    >     type t = mt
>    >   end
>    > end
>
> How about
>
> module M = struct
>   type t = int
>   module BF(T : sig type mt end) = struct
>     type t = T.mt
>   end
>   module B = BF(struct type mt = t end)
> end
>
> ??
>
> Hendirk
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>