> at the beginning of the variant type means the type is open to combination with other variant types
> means lower bound, < means upper bound. If the same set of tags are both an upper and a lower bound, we end up with an exact polymorphic variant type, which has neither marker.
let three = #Int(3)
let four = #Float(4.)
let nan = #Not_a_number
Js.log([three, four, nan])
// list is immutable, so both open & close poly variant are allowed
let lst: list<[> #Int(int) | #Float(float) | #Not_a_number]> = list{three, four, nan}
Js.log(lst)
let lst: list<[< #Int(int) | #Float(float) | #Not_a_number]> = list{three, four, nan}
Js.log(lst)
// Rescript won't compile the following line
let arr: array<[> #Int(int) | #Float(float) | #Not_a_number]> = [three, four, nan] // compilation error
let arr: array<[< #Int(int) | #Float(float) | #Not_a_number]> = [three, four, nan]
Js.log(arr)