I know how to use sharing constraints over abstract types, but this time I wanted the type to have a constructor. A minimal example could be:
module type Key = sig
type t = T of string
end
val create_foo : (module Key with type t = 'k) -> ('k * string) list -> foo
But this fails with:
In this `with' constraint, the new definition of t
does not match its original definition in the constrained signature
And I don’t think there’s a way to write that constraint in the first place. Is it possible? I know I could move the constructor to a type outside Key
and drop the constraint, but I did not want instances of Key
to be compatible. In the end, I went with a different API so I’m asking out of curiosity.