I’m trying to make sense of one aspect of upper and lower bounds for polymorphic variants.
On one hand, you can write:
let x: [< `Red | `Green] = `Red;
On the other hand, you cannot give the type of
x an alias:
type t = [< `Red | `Green];
Only the following works:
type 'a t = [< `Red | `Green] as 'a; let x: 'a t = `Red;
Apparently, there are implicit type variables in play. Is there any material that fully explains how constraints are inferred and propagated; and how they interact with non-constraint types? Thanks!