mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-17 13:27:30 +03:00
2.0 KiB
2.0 KiB
First we add some code:
x = 0
y = x + 1
z = y + 2
Loading changes detected in scratch.u.
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`:
x : Nat
y : Nat
z : Nat
scratch/main> add
⍟ I've added these definitions:
x : Nat
y : Nat
z : Nat
Now we edit x
to be 7
, which should make z
equal 10
:
x = 7
Loading changes detected in scratch.u.
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These names already exist. You can `update` them to your
new definition:
x : Nat
scratch/main> update
Okay, I'm searching the branch for code that needs to be
updated...
That's done. Now I'm making sure everything typechecks...
Everything typechecks, so I'm saving the results...
Done.
scratch/main> view x y z
x : Nat
x = 7
y : Nat
y =
use Nat +
x + 1
z : Nat
z =
use Nat +
y + 2
Uh oh! z
is still referencing the old version. Just to confirm:
test> t1 = if z == 3 then [Fail "nooo!!!"] else [Ok "great"]
Loading changes detected in scratch.u.
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`:
t1 : [Result]
Now evaluating any watch expressions (lines starting with
`>`)... Ctrl+C cancels.
1 | test> t1 = if z == 3 then [Fail "nooo!!!"] else [Ok "great"]
✅ Passed great
scratch/main> add
⍟ I've added these definitions:
t1 : [Result]
scratch/main> test
Cached test results (`help testcache` to learn more)
1. t1 ◉ great
✅ 1 test(s) passing
Tip: Use view 1 to view the source of a test.