Ship

Lexicon · Open variant

Open variant

The structural, extensible variant: a row of lowercase tags wrapped in [ … ] — [ :ready | :error(e) ]. The pair to the nominal closed variant (type Status = | Open | Done). OCaml calls it a polymorphic variant.

  • Bounds: [> row ] (lower), [< row ] (upper), [ row ] (exact).

  • Polymorphic extension uses open-binder: type Timed(open 'r) = [ 'r | :timeout(Duration) ].

  • Built from a kind-Row ingredient; the finished [ … ] is at kind Type.

  • Do not use open variants as the default enum shape. Use a closed variant for ordinary fixed domains, and use open variants when structural row composition is the feature.

    See Ship syntax: open variants.