mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-21 07:17:25 +03:00
1.5 KiB
1.5 KiB
add.run
Basic usage
.> builtins.merge
even : Nat -> Boolean
even x = if x == 0 then true else odd (drop x 1)
odd : Nat -> Boolean
odd x = if x == 0 then false else even (drop x 1)
is2even : 'Boolean
is2even = '(even 2)
it errors if there isn't a previous run
.> add.run foo
.> run is2even
it errors if the desired result name conflicts with a name in the unison file
.> add.run is2even
otherwise, the result is successfully persisted
.> add.run foo.bar.baz
.> view foo.bar.baz
It resolves references within the unison file
z b = b Nat.+ 12
y a b = a Nat.+ b Nat.+ z 10
main : '{IO, Exception} (Nat -> Nat -> Nat)
main _ = y
.> run main
.> add.run result
It resolves references within the codebase
inc : Nat -> Nat
inc x = x + 1
.> add inc
main : '(Nat -> Nat)
main _ x = inc x
.> run main
.> add.run natfoo
.> view natfoo
It captures scratch file dependencies at run time
x = 1
y = x + x
main = 'y
.> run main
x = 50
this saves 2 to xres, rather than 100
.> add.run xres
.> view xres
It fails with a message if add cannot complete cleanly
main = '5
.> run main
.> add.run xres
It works with absolute names
main = '5
.> run main
.> add.run .an.absolute.name
.> view .an.absolute.name