unison/unison-src/transcripts/command-replace.md
2024-01-08 11:53:31 -08:00

691 B

Replace with terms and types

Let's set up some definitions to start:

.lib> builtins.merge
x = 1
y = 2

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

Test that replace works with terms

.> replace x y
.> view x

Test that replace works with types

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

Try with a type/term mismatch

.> replace X x
.> replace y Y

Try with missing references

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