2020-10-23 05:33:12 +03:00
|
|
|
Add `List.zonk` to the codebase:
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2020-10-23 05:33:12 +03:00
|
|
|
List.zonk : [a] -> [a]
|
|
|
|
List.zonk xs = xs
|
2020-10-23 17:01:18 +03:00
|
|
|
|
|
|
|
Text.zonk : Text -> Text
|
|
|
|
Text.zonk txt = txt ++ "!! "
|
2020-10-23 05:33:12 +03:00
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2020-10-23 05:33:12 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2020-10-23 05:33:12 +03:00
|
|
|
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`:
|
|
|
|
|
|
|
|
List.zonk : [a] -> [a]
|
2020-10-23 17:01:18 +03:00
|
|
|
Text.zonk : Text -> Text
|
2020-10-23 05:33:12 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
Now, typecheck a file with a reference to `Blah.zonk` (which doesn't exist in the codebase). This should fail:
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2020-10-23 05:33:12 +03:00
|
|
|
-- should not typecheck as there's no `Blah.zonk` in the codebase
|
|
|
|
> Blah.zonk [1,2,3]
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2020-10-23 05:33:12 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2024-01-25 18:12:10 +03:00
|
|
|
I couldn't figure out what Blah.zonk refers to here:
|
2020-10-23 05:33:12 +03:00
|
|
|
|
|
|
|
2 | > Blah.zonk [1,2,3]
|
|
|
|
|
2024-01-26 20:53:29 +03:00
|
|
|
I think its type should be:
|
|
|
|
|
|
|
|
[Nat] -> o
|
|
|
|
|
2022-07-13 05:08:33 +03:00
|
|
|
Some common causes of this error include:
|
2022-07-13 18:20:12 +03:00
|
|
|
* Your current namespace is too deep to contain the
|
2022-07-13 05:08:33 +03:00
|
|
|
definition in its subtree
|
|
|
|
* The definition is part of a library which hasn't been
|
|
|
|
added to this project
|
2024-01-25 18:12:10 +03:00
|
|
|
* You have a typo in the name
|
2020-10-23 05:33:12 +03:00
|
|
|
|
|
|
|
```
|
2020-10-23 17:01:18 +03:00
|
|
|
Here's another example, just checking that TDNR works for definitions in the same file:
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2020-10-23 17:01:18 +03:00
|
|
|
foo.bar.baz = 42
|
|
|
|
|
|
|
|
qux.baz = "hello"
|
|
|
|
|
|
|
|
ex = baz ++ ", world!"
|
|
|
|
|
|
|
|
> ex
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2020-10-23 17:01:18 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2020-10-23 17:01:18 +03:00
|
|
|
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`:
|
|
|
|
|
|
|
|
ex : Text
|
|
|
|
foo.bar.baz : Nat
|
|
|
|
qux.baz : Text
|
|
|
|
|
|
|
|
Now evaluating any watch expressions (lines starting with
|
|
|
|
`>`)... Ctrl+C cancels.
|
|
|
|
|
|
|
|
7 | > ex
|
|
|
|
⧩
|
|
|
|
"hello, world!"
|
|
|
|
|
|
|
|
```
|
|
|
|
Here's another example, checking that TDNR works when multiple codebase definitions have matching names:
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2020-10-23 17:01:18 +03:00
|
|
|
ex = zonk "hi"
|
|
|
|
|
|
|
|
> ex
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2020-10-23 17:01:18 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2020-10-23 17:01:18 +03:00
|
|
|
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`:
|
|
|
|
|
|
|
|
ex : Text
|
|
|
|
|
|
|
|
Now evaluating any watch expressions (lines starting with
|
|
|
|
`>`)... Ctrl+C cancels.
|
|
|
|
|
|
|
|
3 | > ex
|
|
|
|
⧩
|
|
|
|
"hi!! "
|
|
|
|
|
|
|
|
```
|
|
|
|
Last example, showing that TDNR works when there are multiple matching names in both the file and the codebase:
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2020-10-23 17:01:18 +03:00
|
|
|
woot.zonk = "woot"
|
|
|
|
woot2.zonk = 9384
|
|
|
|
|
|
|
|
ex = zonk "hi" -- should resolve to Text.zonk, from the codebase
|
|
|
|
++ zonk -- should resolve to the local `woot.zonk` from this file
|
|
|
|
|
|
|
|
> ex
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2020-10-23 17:01:18 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2020-10-23 17:01:18 +03:00
|
|
|
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`:
|
|
|
|
|
|
|
|
ex : Text
|
|
|
|
woot.zonk : Text
|
|
|
|
woot2.zonk : Nat
|
|
|
|
|
|
|
|
Now evaluating any watch expressions (lines starting with
|
|
|
|
`>`)... Ctrl+C cancels.
|
|
|
|
|
|
|
|
7 | > ex
|
|
|
|
⧩
|
|
|
|
"hi!! woot"
|
|
|
|
|
|
|
|
```
|