2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2024-01-06 03:58:47 +03:00
|
|
|
structural ability Ask where ask : Nat
|
2020-11-11 20:33:46 +03:00
|
|
|
|
2024-01-06 03:58:47 +03:00
|
|
|
ability Zoot where
|
2020-11-11 20:33:46 +03:00
|
|
|
zoot : Nat
|
|
|
|
|
|
|
|
Ask.provide : '{Zoot} Nat -> '{Ask} r -> r
|
|
|
|
Ask.provide answer asker =
|
|
|
|
h = cases
|
|
|
|
{r} -> r
|
|
|
|
{Ask.ask -> resume} -> handle resume !answer with h
|
|
|
|
handle !asker with h
|
|
|
|
|
|
|
|
dialog = Ask.provide 'zoot '("Awesome number: " ++ Nat.toText Ask.ask ++ "!")
|
|
|
|
|
|
|
|
> dialog
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2020-11-11 20:33:46 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2024-01-04 11:42:12 +03:00
|
|
|
The expression in red needs the {Zoot} ability, but this location does not have access to any abilities.
|
2020-11-11 20:33:46 +03:00
|
|
|
|
2024-01-04 11:42:12 +03:00
|
|
|
13 | dialog = Ask.provide 'zoot '("Awesome number: " ++ Nat.toText Ask.ask ++ "!")
|
2020-11-11 20:33:46 +03:00
|
|
|
|
|
|
|
|
|
|
|
```
|