OCaml functor taking polymorphic variant type -
trying compile
module f (m : sig type t = [> `foo ] end) = struct type t = [ m.t | `bar ] end gets me
error: type variable unbound in type declaration. in type [> `foo ] 'a variable 'a unbound what doing wrong?
type t = [> `foo] invalid since [> `foo] open type , contains type variable implicitly. definition rejected next type definition rejected since rhs has type variable not quantified in lhs:
type t = 'a list you have create closed:
type t = [ `foo ] or quantify type variable:
type 'a t = [> `foo] 'a which equivalent to
type 'a t = 'a constraint 'a = [> `foo] ocaml
No comments:
Post a Comment