mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
roc format examples
This commit is contained in:
parent
7ed35eca50
commit
7908e8c176
32 changed files with 231 additions and 232 deletions
|
@ -13,7 +13,7 @@ main = closure1 {}
|
||||||
closure1 : {} -> Task.Task {} []
|
closure1 : {} -> Task.Task {} []
|
||||||
closure1 = \_ ->
|
closure1 = \_ ->
|
||||||
Task.succeed (foo toUnitBorrowed "a long string such that it's malloced")
|
Task.succeed (foo toUnitBorrowed "a long string such that it's malloced")
|
||||||
|> Task.map (\_ -> {})
|
|> Task.map \_ -> {}
|
||||||
|
|
||||||
toUnitBorrowed = \x -> Str.countGraphemes x
|
toUnitBorrowed = \x -> Str.countGraphemes x
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ main =
|
||||||
f = pow x x
|
f = pow x x
|
||||||
|
|
||||||
nest deriv n f # original koka n = 10
|
nest deriv n f # original koka n = 10
|
||||||
|> Task.map (\_ -> {})
|
|> Task.map \_ -> {}
|
||||||
|
|
||||||
nest : (I64, Expr -> IO Expr), I64, Expr -> IO Expr
|
nest : (I64, Expr -> IO Expr), I64, Expr -> IO Expr
|
||||||
nest = \f, n, e -> Task.loop { s: n, f, m: n, x: e } nestHelp
|
nest = \f, n, e -> Task.loop { s: n, f, m: n, x: e } nestHelp
|
||||||
|
|
|
@ -21,7 +21,7 @@ InterpreterErrors : [BadUtf8, DivByZero, EmptyStack, InvalidBooleanValue, Invali
|
||||||
main : Str -> Task {} []
|
main : Str -> Task {} []
|
||||||
main = \filename ->
|
main = \filename ->
|
||||||
interpretFile filename
|
interpretFile filename
|
||||||
|> Task.onFail (\StringErr e -> Stdout.line "Ran into problem:\n\(e)\n")
|
|> Task.onFail \StringErr e -> Stdout.line "Ran into problem:\n\(e)\n"
|
||||||
|
|
||||||
interpretFile : Str -> Task {} [StringErr Str]
|
interpretFile : Str -> Task {} [StringErr Str]
|
||||||
interpretFile = \filename ->
|
interpretFile = \filename ->
|
||||||
|
|
|
@ -24,8 +24,7 @@ fromUtf8 = \char ->
|
||||||
char
|
char
|
||||||
>= 0x61 # "a"
|
>= 0x61 # "a"
|
||||||
&& char
|
&& char
|
||||||
<= 0x7A
|
<= 0x7A # "z"
|
||||||
# "z"
|
|
||||||
then
|
then
|
||||||
Ok (@Variable char)
|
Ok (@Variable char)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue