mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-21 15:28:15 +03:00
1.0 KiB
1.0 KiB
.> builtins.merge
Add List.zonk
to the codebase:
List.zonk : [a] -> [a]
List.zonk xs = xs
Text.zonk : Text -> Text
Text.zonk txt = txt ++ "!! "
.> add
Now, typecheck a file with a reference to Blah.zonk
(which doesn't exist in the codebase). This should fail:
-- should not typecheck as there's no `Blah.zonk` in the codebase
> Blah.zonk [1,2,3]
Here's another example, just checking that TDNR works for definitions in the same file:
foo.bar.baz = 42
qux.baz = "hello"
ex = baz ++ ", world!"
> ex
Here's another example, checking that TDNR works when multiple codebase definitions have matching names:
ex = zonk "hi"
> ex
Last example, showing that TDNR works when there are multiple matching names in both the file and the codebase:
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