mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
1.1 KiB
1.1 KiB
scratch/main> builtins.merge
unique type codebase.Foo = Foo
Woot.state : Nat
Woot.state = 42
Woot.frobnicate : Nat
Woot.frobnicate = 43
scratch/main> add
unique type Oog.Foo = Foo Text
unique ability Blah where
foo : Foo -> ()
unique type Something = { state : Text }
oog = do
foo (Foo "hi" : Oog.Foo)
ex = do
s = Something "hello"
state s ++ " world!"
-- check that using locally unique suffix shadows the `Foo` in codebase
fn1 : Foo -> Foo -> Nat
fn1 = cases Foo a, Foo b -> Text.size a Nat.+ Text.size b
-- check that using local fully qualified name works fine
fn2 : Oog.Foo -> Oog.Foo -> Text
fn2 = cases Foo a, Foo b -> a Text.++ b
-- check that using fully qualified name works fine
fn3 : codebase.Foo -> codebase.Foo -> Text
fn3 = cases codebase.Foo.Foo, codebase.Foo.Foo -> "!!!!!!"
> fn3 codebase.Foo.Foo codebase.Foo.Foo
-- now checking that terms fully qualified names work fine
blah.frobnicate = "Yay!"
> Something.state (Something "hi")
> Woot.state + 1
> Woot.frobnicate + 2
> frobnicate Text.++ " 🎉"
> blah.frobnicate Text.++ " 🎉"