I am a bit confused…
I would like to use a constrained type for an abstract type (for example to instantiate a functor),
like in the following.
module type S = sig type 'a t end module I = struct type 'a t = [< `A | `B] as 'a end module I' = struct type 'a t = 'a end module I_ok = (I' : S) module I_error = (I : S);;
But I get for the line
I_error (in utop with OCaml 4.05.0):
Error: Signature mismatch: Modules do not match: sig type 'a t = 'a constraint 'a = [< `A | `B ] end is not included in S Type declarations do not match: type 'a t = 'a constraint 'a = [< `A | `B ] is not included in type 'a t Their constraints differ.
which I don’t really understand.
Thank you for your help,