unison/unison-src/tests/rainbow.u
2021-08-24 11:33:27 -07:00

33 lines
653 B
Plaintext

-- Hits all the syntactic elements listed in SyntaxHighlights.hs.
-- Use the 'view' command to see this in colour.
rainbow : Int ->{Ask Int} Int
rainbow x =
use Int isEven
number = 3
text = "hello"
float = 3.14
bool = false
lam z =
use Nat * +
z + 1 * 2
seq = [1, 2, 3]
delay : '(Int -> Boolean)
delay _ = isEven
force = !delay +2
a = if isEven x then Either.Left 0 else Either.Right 0
b = if isEven x then 1 else 0
c = match x with _ -> 3
d = (Ask.ask : Int)
+42
structural ability Ask a where
ask : {Ask a} a
structural type Either a b = Left a | Right b
unique ability Zang where
zang : {Zang} Nat
> ()