A user-defined ability is declared with anability
declaration such as:
Abilities need to be defined with either thestructural
orunique
keyword. See the sections onunique typesandstructural-typesfor more detail on the difference.
This results in a new ability type constructorStore
which takes a type argumenta
.It also create two value-level constructors namedStore.get
andStore.put
.The idea is thatStore.get
provides the ability to "get" a value of typea
from somewhere, andStore.put
allows "putting" a value of typea
somewhere. Where exactly these values of typea
will be kept depends on the handler.
TheStore
constructorsStore.get
andStore.put
have the following types:
The type{Store v}
means that the computation which results in that type requires aStore v
ability and cannot be executed except in the context of anability handlerthat provides the ability.