Why do you want to limit the argument signature of your functor? Here you do not need with type :
module Make (Ord : Map.OrderedType) = struct include Map.Make(Ord) let aaa = 1 end
gives a functor Make , which, when implementing Map.OrderedType returns a module with all Map.S functions, a key type equal to Ord.t , and an aaa value of type int .
If you want to force the result of your functor to adhere to a specific signature, you really need to add type constraints, for example.
module type MyMap = sig include Map.S val aaa: int end module MakeAbstract (Ord : Map.OrderedType): MyMap with type key = Ord.t = struct include Map.Make(Ord) let aaa = 1 end
There is one difference between Make and MakeAbstract . The former is of type t , equal to MapMake(Ord).t , and the latter is of the abstract type t
source share