Reputation: 584
I'm trying to accomplish the following:
module type S = sig
type 'a t
end
module A = struct
type 'a t = 'a list
end
module B = struct
type ('a,'b) t = ('a * 'b) list
end
module Make (P : S) = struct
type 'a t = 'a P.t
end
module Single = struct
include Make (A)
end
module Tuple = struct
include Make (B)
end
Basically, I want to reuse the make functor, except for in Tuple, force the type to be a tuple. Is this possible?
I think the module type S is messing it up, which is giving me the error: They have different arities. Maybe it is possible to get this working using first class modules?
Thanks!
Upvotes: 0
Views: 128
Reputation: 9878
What are you trying to accomplish? If you forget about functors for a second you will see that your module B
cannot satisfy the signature S
. For example:
module B1 = (B : S)
Will give you the same error. The problem here is that your type t
in your singature S
only accepts 1 type variable. You cannot apply this signature to a module with type t
with 2 type variables.
Upvotes: 1