Ability handlers

A constructor{A} Tfor some abilityAand some typeT(or a function which uses such a constructor), can only be used in a scope where the abilityAis provided. Abilities are provided byhandleexpressions:

handle e with h

This expression giveseaccess to abilities handled by the functionh.Specifically, ifehas type{A} Tandhhas typeRequest A T -> R,thenhandle e with hhas typeR.The type constructorRequestis a special builtin provided by Unison which will pass arguments of typeRequest A Tto a handler for the abilityA.Note thathmustaccept an argument of typeRequest A Tto handleeof type{A} T- ultimately, a type error will result if an ability is required in a scope where it is not provided by an enclosing handle expression.

The examples in the next section should help clarify how ability handlers work.