Version française
Home     About     Download     Resources     Contact us    
Browse thread
functor troubles
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keiko Nakata <keiko@k...>
Subject: Re: [Caml-list] functor troubles
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.