Ability patterns (or Request patterns)
An ability pattern only appears in an ability handler and has one of two forms (see Abilities and ability handlers for details):
{C p1 p2 … pn -> k}whereCis the name of an ability constructor in scope, andp1throughpnare patterns such thatnis the arity ofC. Note thatnmay be zero. This pattern matches if the scrutinee reduces to a fully applied invocation of the ability constructorCand the patternsp1throughpnmatch the arguments to the constructor. The scrutinee must be of typeRequest A Tfor some ability{A}and typeT. The variablekwill be bound to the continuation of the program. If the scrutinee has typeRequest A TandChas typeX ->{A} Y, thenkhas typeY -> {A} T.{p}wherepis a pattern. This matches the case where the computation is pure (the value of typeRequest A Tcalls none of the constructors of the ability{A}). A pattern match on aRequestis not complete unless this case is handled.
See the section on abilities and ability handlers for examples of ability patterns.