2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2021-08-20 21:50:05 +03:00
|
|
|
f : '{} Nat
|
|
|
|
f _ = 5
|
|
|
|
|
|
|
|
fc : '{IO, Exception} Nat
|
|
|
|
fc = unsafe.coerceAbilities f
|
|
|
|
|
|
|
|
main : '{IO, Exception} [Result]
|
|
|
|
main _ =
|
|
|
|
n = !fc
|
|
|
|
if n == 5 then [Ok ""] else [Fail ""]
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2021-08-20 21:50:05 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2021-08-20 21:50:05 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These new definitions are ok to `add`:
|
|
|
|
|
|
|
|
f : 'Nat
|
|
|
|
fc : '{IO, Exception} Nat
|
|
|
|
main : '{IO, Exception} [Result]
|
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> find unsafe.coerceAbilities
|
2021-08-20 21:50:05 +03:00
|
|
|
|
2023-08-18 00:55:28 +03:00
|
|
|
1. builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a -> b
|
2021-08-20 21:50:05 +03:00
|
|
|
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> add
|
2021-08-20 21:50:05 +03:00
|
|
|
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
|
|
|
|
f : 'Nat
|
|
|
|
fc : '{IO, Exception} Nat
|
|
|
|
main : '{IO, Exception} [Result]
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> io.test main
|
2021-08-20 21:50:05 +03:00
|
|
|
|
|
|
|
New test results:
|
|
|
|
|
2024-06-27 08:14:37 +03:00
|
|
|
1. main ◉
|
2021-08-20 21:50:05 +03:00
|
|
|
|
|
|
|
✅ 1 test(s) passing
|
|
|
|
|
2024-06-26 23:01:36 +03:00
|
|
|
Tip: Use view 1 to view the source of a test.
|
2021-08-20 21:50:05 +03:00
|
|
|
|
|
|
|
```
|