Ship

Lexicon · Coercion

Coercion

Explicit type conversion checked by the compiler, written :>:

value :> TargetType

The conversion is accepted only when the source type is validly viewable as the target type. The settled first use is row widening for open variants:

type Readiness = [ :ready | :waiting ]
type Timed(open 'r) = [ 'r | :timeout(Duration) ]

let as_timed = fn('r)(readiness: 'r) -> Timed('r) {
  return readiness :> Timed('r);
}

Ship does not have general subtyping. :> is for valid, compiler-known coercions such as row widening, not arbitrary casts.

See row-extension, open-binder, and ../01-syntax.md.