Ability patterns (orRequestpatterns)

Anability patternonly appears in an ability handler and has one of two forms (seeAbilities and ability handlersfor details):

  1. {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.
  2. {p}wherepis a pattern. This matches the case where the computation ispure(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 onabilities and ability handlersfor examples of ability patterns.