Is there a way to write down a module signature such that we can guarantee a contained type t
expands to a polymorphic variant?
As an example, we can write the following:
module Base = struct
type t = [ `One | `Two]
end
module Extended = struct
type t = [ `More | Base.t ]
end
and we have
module Extended : sig
type t = [ `More | `One | `Two ]
end
However, I don’t know what signature I should provide to write this general case as functor i.e.
module Extend (Base: sig type t = ??? end) = struct
type t = [`More | Base.t]
end
Is there any way to do this, perhaps using constraints?