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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] functor substitution gives error
I think I just hit the same kind problem.

This doesn't compile :
----
module A : sig
  type m
  module M : sig
    type t = m
  end
end = struct
  module M = struct
    module S = String
    module Smap = Map.Make(S)
    type t = int Smap.t
  end
  type m = M.t
end
----

 Type declarations do not match:
         type t = int Smap.t
       is not included in
         type t = m

However if I put S outside M, or if I specify the type of Smap it compiles :

----
module A : sig
  type m
  module M : sig
    type t = m
  end
end = struct
  module S = String
  module M = struct
    module Smap = Map.Make(S)
    type t = int Smap.t
  end
  type m = M.t
end
----

----
module A : sig
  type m
  module M : sig
    type t = m
  end
end = struct
  module M = struct
    module S = String
    module Smap = (Map.Make(S) : Map.S with type key = S.t)
    type t = int Smap.t
  end
  type m = M.t
end
----

Daniel