Row subtraction
Remove tags from a row with - after the source row. Everything after - is subtracted from the type on the left.
type WorkStatus = [ :ready | :waiting | :paused ]
type NotWaiting = [ WorkStatus - :waiting ]
type NotWaiting = [ WorkStatus - | :waiting ] // optional | after -
type OnlyPaused = [ WorkStatus - :ready | :waiting ]
type Lower = [> WorkStatus - :ready ]
type Upper = [< WorkStatus - :ready ]
In
match, a namedrestarm binds the subtracted residual row (see../01-syntax.md).On the exception row, handled
error :tagarms subtract tags; inferred signatures may showexn [ 'row - :tag ](see../08-errors.md).Payload tags must match exactly; subtracting a missing or mismatched tag is a compile error.
Pair with row-extension. See
crates/ship-types/tests/golden/check-types-row-subtraction/.