lang/tests/formatting.langexp
2023-07-25 21:33:57 +03:00

233 lines
1.7 KiB
Text

// import
:: x = y : func1 func2 func3 func4 func5;
:: x = y :
func1
func2
func3
func4
func5;
// type
: info
@a annotation info
Type = @a A;
Type 'A 'B 'C = @a1 'A | @b2 'B | @c2 'C;
Type 'A 'B 'C
= @a1 'A | @b2 'B | @c2 'C;
Type
'A
'B
'C
= @a1 'A | @b2 'B | @c2 'C;
Type 'A 'B 'C =
| & @a1 'A
& @b1 'B
& @c1 'C
| @a2 'A & @b2 'B & @c2 'C;
Type
'A
'B
'C
=
| & @a1 'A
& @b1 'B
& @c1 'C
| @a2 'A & @b2 'B & @c2 'C;
Type {
func1;
func2;
func3;
}
// typeclass
: info
#Typeclass;
#Typeclass : #A #B #C;
#Typeclass :
#A
#B
#C;
// function
: info
@a annotation info
func 'a;
func 'a 'b 'c : A B C -> D;
func
'a
'b
'c
: A B C -> D;
func 'a 'b 'c
: A B C -> D;
func
'a
'b
'c
: A B C -> D;
func 'a 'b 'c
:
A
B
C
-> D;
func
'a
'b
'c
:
A
B
C
-> D;
// flow control
func = {
x := y => do_something
:= z
=> do_something;
@ => do_something;
@ a => do_something;
@ a
=> do_something;
@ a : b => do_something;
@ a : b
=> do_something;
}
// operators, containers, modifiers
func = {
x + y;
x
+ y;
{
expr;
expr;
expr;
};
[[ expr expr expr ]];
[[
expr
expr
expr
]];
return x;
return
x;
%x;
a[b];
a[
b];
a.11;
break;
<> x;
x?;
}
// other
func = {
x
.func a b c;
x
.func
a
b
c;
Type.func a b c;
Type.func
a
b
c;
Type @a x @b y @c z;
Type
@a x
@b y
@c z;
\ 'x 'y 'z => x;
\ 'x
'y
'z
=> x;
\ 'x 'y 'z
=> x;
\ 'x
'y
'z
=>
x;
(x);
(
x
);
}