mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Format all lambdas to new syntax
This commit is contained in:
parent
9d37c906fe
commit
1b43ffa579
70 changed files with 1105 additions and 669 deletions
|
@ -1,4 +1,4 @@
|
|||
il3 \k -> # w#z
|
||||
il3 |k| # w#z
|
||||
CCC @C ( # i
|
||||
t! K) : i
|
||||
C
|
|
@ -1,5 +1,5 @@
|
|||
launchTheNukes : {} => Result Bool LaunchNukeErr
|
||||
launchTheNukes = \{} ->
|
||||
launchTheNukes = |{}|
|
||||
crash "todo"
|
||||
|
||||
launchTheNukes
|
|
@ -1,3 +1,3 @@
|
|||
! !(
|
||||
\w -> 2)
|
||||
|w| 2)
|
||||
n
|
|
@ -1,2 +1,2 @@
|
|||
foo
|
||||
|> Dict.keepIf \(k, _v) -> List.contains keysToDelete k |> Bool.not
|
||||
|> Dict.keepIf |(k, _v)| List.contains keysToDelete k |> Bool.not
|
|
@ -1,2 +1,2 @@
|
|||
\({ x, y } as point), (@Location inner as outer) ->
|
||||
|({ x, y } as point), (@Location inner as outer)|
|
||||
crash ""
|
|
@ -1,4 +1,4 @@
|
|||
d
|
||||
+
|
||||
(\w -> x)
|
||||
(|w| x)
|
||||
x
|
|
@ -1 +1 @@
|
|||
\L -> E #
|
||||
|L| E #
|
|
@ -1 +1 @@
|
|||
\(8) -> T #
|
||||
|(8)| T #
|
|
@ -1,3 +1,3 @@
|
|||
\I { p ?? Y
|
||||
Y } [] ->
|
||||
|I { p ?? Y
|
||||
Y } []|
|
||||
K # (
|
|
@ -1,2 +1,2 @@
|
|||
m0 \w -> w? e
|
||||
m0 |w| w? e
|
||||
/ s
|
|
@ -1,2 +1,2 @@
|
|||
i > \s -> s
|
||||
i > |s| s
|
||||
-a
|
|
@ -1,3 +1,3 @@
|
|||
\L -> {
|
||||
|L| {
|
||||
}
|
||||
Θ
|
|
@ -1 +1 @@
|
|||
\L(z) -> 42
|
||||
|L(z)| 42
|
|
@ -1,3 +1,3 @@
|
|||
\{ i, #
|
||||
|{ i, #
|
||||
e }
|
||||
-> a
|
||||
| a
|
|
@ -1,3 +1,3 @@
|
|||
m
|
||||
^ (-(\w -> m))
|
||||
^ (-(|w| m))
|
||||
w
|
|
@ -0,0 +1 @@
|
|||
|_, _name| 42
|
|
@ -1,3 +1,3 @@
|
|||
\L #
|
||||
|L #
|
||||
i
|
||||
-> -e
|
||||
| -e
|
|
@ -1,4 +1,4 @@
|
|||
\L,
|
||||
|L,
|
||||
M #
|
||||
Q
|
||||
-> f8
|
||||
| f8
|
|
@ -1,7 +1,7 @@
|
|||
_ = crash ""
|
||||
_ = crash "" ""
|
||||
_ = crash 15 123
|
||||
_ = try foo (\_ -> crash "")
|
||||
_ = try foo (|_| crash "")
|
||||
_ =
|
||||
_ = crash ""
|
||||
crash
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
launchTheNukes! = \{} ->
|
||||
launchTheNukes! = |{}|
|
||||
boom
|
||||
|
||||
launchTheNukes! {}
|
|
@ -1,3 +1,3 @@
|
|||
\j ->
|
||||
e \B -> B
|
||||
|j|
|
||||
e |B| B
|
||||
> s
|
|
@ -1,4 +1,4 @@
|
|||
\{} ->
|
||||
|{}|
|
||||
echo "Welcome to the DMV!"
|
||||
age = readInt
|
||||
|
||||
|
|
|
@ -3,5 +3,5 @@ table :
|
|||
height : Pixels,
|
||||
}
|
||||
-> Table
|
||||
table = \{ height } -> crash "not implemented"
|
||||
table = |{ height }| crash "not implemented"
|
||||
table
|
|
@ -1,4 +1,4 @@
|
|||
f : (Str)a -> (Str)a
|
||||
f = \x -> x
|
||||
f = |x| x
|
||||
|
||||
f ("Str", 42)
|
|
@ -1,4 +1,4 @@
|
|||
f : I64 -> (I64, I64)
|
||||
f = \x -> (x, x + 1)
|
||||
f = |x| (x, x + 1)
|
||||
|
||||
f 42
|
|
@ -1,3 +1,3 @@
|
|||
\L ->
|
||||
|L|
|
||||
import U
|
||||
{} e
|
|
@ -0,0 +1,4 @@
|
|||
"a string"
|
||||
|> Str.toUtf8
|
||||
|> List.map |byte| byte + 1
|
||||
|> List.reverse
|
|
@ -1,2 +1,2 @@
|
|||
\x ->
|
||||
|x|
|
||||
1
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
[
|
||||
!(!(\L -> t))
|
||||
!(!(|L| t))
|
||||
M,
|
||||
],
|
||||
]
|
|
@ -1,6 +1,6 @@
|
|||
when
|
||||
f
|
||||
is
|
||||
s if \t ->
|
||||
s if |t|
|
||||
"""
|
||||
""" -> e
|
|
@ -0,0 +1,6 @@
|
|||
main =
|
||||
wrappedNotEq : a, a -> Bool
|
||||
wrappedNotEq = |num1, num2|
|
||||
num1 != num2
|
||||
|
||||
wrappedNotEq 2 3
|
|
@ -1,6 +1,6 @@
|
|||
\I
|
||||
|I
|
||||
[[
|
||||
O #
|
||||
,
|
||||
i]]
|
||||
-> i
|
||||
| i
|
|
@ -0,0 +1,4 @@
|
|||
my_var =
|
||||
some_var # c
|
||||
|| other_thing # ^D
|
||||
final_expr
|
|
@ -0,0 +1,85 @@
|
|||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-62,
|
||||
],
|
||||
space_before: [
|
||||
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||
],
|
||||
space_after: [
|
||||
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
|
||||
],
|
||||
spaces: [
|
||||
Newline,
|
||||
],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-6 Identifier {
|
||||
ident: "my_var",
|
||||
},
|
||||
@14-62 SpaceBefore(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@14-43,
|
||||
],
|
||||
space_before: [
|
||||
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||
],
|
||||
space_after: [
|
||||
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@14-43 BinOps(
|
||||
[
|
||||
(
|
||||
@14-22 SpaceAfter(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "some_var",
|
||||
},
|
||||
[
|
||||
LineComment(
|
||||
" c",
|
||||
),
|
||||
],
|
||||
),
|
||||
@30-32 Or,
|
||||
),
|
||||
],
|
||||
@32-43 Var {
|
||||
module_name: "",
|
||||
ident: "other_thing",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@52-62 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "final_expr",
|
||||
},
|
||||
[
|
||||
LineComment(
|
||||
" ^D",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
my_var =
|
||||
some_var# c
|
||||
||other_thing# ^D
|
||||
final_expr
|
|
@ -0,0 +1,7 @@
|
|||
main =
|
||||
parseArgs? {}
|
||||
|> List.dropFirst 1
|
||||
|> List.mapTry? Str.toU8
|
||||
|> List.sum
|
||||
|> |total| "Sum of numbers: ${Num.to_str total}"
|
||||
|> Str.toUpper
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
answer: 42,
|
||||
launchTheNukes!: \{} -> boom,
|
||||
launchTheNukes!: |{}| boom,
|
||||
}
|
|
@ -1,2 +1,2 @@
|
|||
&rm? \L2 -> t
|
||||
&rm? |L2| t
|
||||
+ c
|
|
@ -1,4 +1,4 @@
|
|||
maybeEarlyReturn = \x ->
|
||||
maybeEarlyReturn = |x|
|
||||
y =
|
||||
if x > 5 then
|
||||
return "abc"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
maybeEarlyReturn = \x ->
|
||||
maybeEarlyReturn = |x|
|
||||
y =
|
||||
when x is
|
||||
5 ->
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
identityFn = \x ->
|
||||
identityFn = |x|
|
||||
return x
|
||||
|
||||
identityFn 45
|
|
@ -0,0 +1 @@
|
|||
|a| 42
|
|
@ -1 +1 @@
|
|||
\the_answer -> 42
|
||||
|the_answer| 42
|
|
@ -0,0 +1 @@
|
|||
|_| 42
|
|
@ -0,0 +1 @@
|
|||
|Thing| 42
|
|
@ -0,0 +1 @@
|
|||
|a, b, c| 42
|
|
@ -1,4 +1,4 @@
|
|||
f : (Str, Str) -> (Str, Str)
|
||||
f = \x -> x
|
||||
f = |x| x
|
||||
|
||||
f (1, 2)
|
|
@ -1,4 +1,4 @@
|
|||
f : (Str, Str)a -> (Str, Str)a
|
||||
f = \x -> x
|
||||
f = |x| x
|
||||
|
||||
f (1, 2)
|
|
@ -0,0 +1 @@
|
|||
|a, b| 42
|
|
@ -0,0 +1,4 @@
|
|||
foo : Int, Float -> Bool
|
||||
foo = |x, _| 42
|
||||
|
||||
42
|
|
@ -1,3 +1,3 @@
|
|||
nextWhileLess : List Bucket, k, U8 -> (U64, U32) where k implements Hash & Eq
|
||||
nextWhileLess = \buckets, key, shifts -> foo
|
||||
nextWhileLess = |buckets, key, shifts| foo
|
||||
nextWhileLess
|
|
@ -1,4 +1,4 @@
|
|||
\A ->
|
||||
|A|
|
||||
if !s! then
|
||||
f
|
||||
else
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
when
|
||||
f
|
||||
is
|
||||
s if (\t ->
|
||||
s if (|t|
|
||||
when
|
||||
0
|
||||
is
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
func = \x ->
|
||||
func = |x|
|
||||
when n is
|
||||
0 -> 0
|
||||
42
|
|
@ -1,4 +1,4 @@
|
|||
func = \x ->
|
||||
func = |x|
|
||||
when n is
|
||||
0 -> 0
|
||||
42
|
File diff suppressed because it is too large
Load diff
|
@ -564,6 +564,7 @@ mod test_snapshots {
|
|||
pass/nested_list_comment_in_closure_arg.expr,
|
||||
pass/nested_parens_in_pattern.expr,
|
||||
pass/nested_when_comment_in_pat.expr,
|
||||
pass/new_lambda_as_second_statement.moduledefs,
|
||||
pass/newline_after_equals.expr, // Regression test for https://github.com/roc-lang/roc/issues/51
|
||||
pass/newline_after_import_str_as.expr,
|
||||
pass/newline_after_mul.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue