mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-17 13:27:30 +03:00
0031542faf
This is for consistency with the `cmark` style. Now the blocks we still pretty-print ourselves will match the bulk of them that `cmark` produces.
2.5 KiB
2.5 KiB
unique type codebase.Foo = Foo
Woot.state : Nat
Woot.state = 42
Woot.frobnicate : Nat
Woot.frobnicate = 43
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.++ " 🎉"
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`:
ability Blah
type Oog.Foo
type Something
Something.state : Something -> Text
Something.state.modify : (Text ->{g} Text)
-> Something
->{g} Something
Something.state.set : Text -> Something -> Something
blah.frobnicate : Text
ex : 'Text
fn1 : Oog.Foo -> Oog.Foo -> Nat
fn2 : Oog.Foo -> Oog.Foo -> Text
fn3 : codebase.Foo
-> codebase.Foo
-> Text
oog : '{Blah} ()
Now evaluating any watch expressions (lines starting with
`>`)... Ctrl+C cancels.
27 | > fn3 codebase.Foo.Foo codebase.Foo.Foo
⧩
"!!!!!!"
32 | > Something.state (Something "hi")
⧩
"hi"
33 | > Woot.state + 1
⧩
43
34 | > Woot.frobnicate + 2
⧩
45
35 | > frobnicate Text.++ " 🎉"
⧩
"Yay! 🎉"
36 | > blah.frobnicate Text.++ " 🎉"
⧩
"Yay! 🎉"