Skip to content

Unary Operations

operator operand
expression function type method types
+_ do_pos DoesPos __pos__ CanPos[+R], CanPosSelf[+R?]
-_ do_neg DoesNeg __neg__ CanNeg[+R], CanNegSelf[+R?]
~_ do_invert DoesInvert __invert__ CanInvert[+R], CanInvertSelf[+R?]
abs(_) do_abs DoesAbs __abs__ CanAbs[+R], CanAbsSelf[+R?]

The Can*Self variants return -> Self instead of R. Since optype 0.12.1 these also accept an optional R type parameter (with a default of Never), which, when provided, will result in a return type of -> Self | R.