mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
80 lines
1.4 KiB
Markdown
80 lines
1.4 KiB
Markdown
``` unison
|
|
unique type Foo
|
|
= Bar Nat
|
|
| Baz Nat Nat
|
|
|
|
foo : Foo -> Nat
|
|
foo = cases
|
|
Bar n -> n
|
|
Baz n m -> n + m
|
|
```
|
|
|
|
``` ucm
|
|
|
|
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`:
|
|
|
|
type Foo
|
|
foo : Foo -> Nat
|
|
|
|
```
|
|
``` ucm
|
|
scratch/main> add
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
type Foo
|
|
foo : Foo -> Nat
|
|
|
|
```
|
|
``` unison
|
|
unique type Foo
|
|
= Bar Nat
|
|
```
|
|
|
|
``` ucm
|
|
|
|
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:
|
|
|
|
type Foo
|
|
|
|
```
|
|
``` ucm
|
|
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...
|
|
|
|
Typechecking failed. I've updated your scratch file with the
|
|
definitions that need fixing. Once the file is compiling, try
|
|
`update` again.
|
|
|
|
```
|
|
``` unison:added-by-ucm scratch.u
|
|
type Foo = Bar Nat
|
|
|
|
-- The definitions below no longer typecheck with the changes above.
|
|
-- Please fix the errors and try `update` again.
|
|
|
|
foo : Foo -> Nat
|
|
foo = cases
|
|
Bar n -> n
|
|
Baz n m -> n Nat.+ m
|
|
|
|
```
|
|
|