unison/unison-src/transcripts/command-replace.md
2021-08-23 14:09:27 -07:00

786 B

Replace with terms and types

Let's set up some definitions to start:

.> builtins.merge
x = 1
y = 2

structural type X = One Nat
structural type Y = Two Nat Nat
.scratch> add

Test that replace works with terms

.scratch> replace x y
.scratch> view x

Test that replace works with types

.scratch> replace X Y
.scratch> find
.scratch> view.patch patch
.scratch> view X

Try with a type/term mismatch

.scratch> replace X x
.scratch> replace y Y

Try with missing references

.scratch> replace X NOPE
.scratch> replace y nope
.scratch> replace nope X
.scratch> replace nope y
.scratch> replace nope nope