Skip to content

Commit b0b62d9

Browse files
Use Roc zero-arg syntax
1 parent 995968c commit b0b62d9

39 files changed

Lines changed: 241 additions & 255 deletions

examples/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

examples/command.roc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import pf.Stdout
1010
import pf.Stderr
1111
import http.Response
1212

13-
# To run this example: check the README.md in this folder
13+
# To run this example: check the root README.md
1414

1515
Model : {}
1616

1717
program = { init!, respond! }
1818

19-
init! : {} => Try(Model, [Exit(I64), ..])
20-
init! = |{}| {
19+
init! : () => Try(Model, [Exit(I64), ..])
20+
init! = || {
2121
result = || {
2222
# Simplest way to execute a command (prints to your terminal).
2323
Cmd.exec!("echo", ["Hello"])?
@@ -70,7 +70,7 @@ init! = |{}| {
7070

7171
respond! : Http.Request, Model => Try(Http.Response, [ServerErr(Str), ..])
7272
respond! = |req, _model| {
73-
millis = Utc.to_millis_since_epoch(Utc.now!({}))
73+
millis = Utc.to_millis_since_epoch(Utc.now!())
7474

7575
# Log request time, method and url using echo
7676
match Cmd.exec!("echo", ["${millis.to_str()} ${Str.inspect(req.method())} ${req.uri()}"]) {

examples/dir.roc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import pf.Http
1010
import pf.Path
1111
import http.Response
1212

13-
# To run this example: check the README.md in this folder
13+
# To run this example: check the root README.md
1414

1515
Model : {}
1616

1717
program = { init!, respond! }
1818

19-
init! : {} => Try(Model, [Exit(I64), ..])
20-
init! = |{}| {
19+
init! : () => Try(Model, [Exit(I64), ..])
20+
init! = || {
2121
result = || {
2222
# Create a directory
2323
Dir.create!("empty-dir")?

examples/echo.roc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import pf.Http
77
import pf.Stdout
88
import http.Response
99

10-
# To run this example: check the README.md in this folder
10+
# To run this example: check the root README.md
1111

1212
## Echo server: logs the request method/uri and replies with the request body.
1313

1414
Model : {}
1515

1616
program = { init!, respond! }
1717

18-
init! : {} => Try(Model, [Exit(I64), ..])
19-
init! = |{}| Ok({})
18+
init! : () => Try(Model, [Exit(I64), ..])
19+
init! = || Ok({})
2020

2121
respond! : Http.Request, Model => Try(Http.Response, [ServerErr(Str), ..])
2222
respond! = |req, _model| {

examples/env.roc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import pf.Env
77
import pf.Http
88
import http.Response
99

10-
# To run this example: check the README.md in this folder
10+
# To run this example: check the root README.md
1111

1212
Model : {}
1313

1414
program = { init!, respond! }
1515

16-
init! : {} => Try(Model, [Exit(I64), ..])
17-
init! = |{}| Ok({})
16+
init! : () => Try(Model, [Exit(I64), ..])
17+
init! = || Ok({})
1818

1919
respond! : Http.Request, Model => Try(Http.Response, [ServerErr(Str), ..])
2020
respond! = |_request, _model|

examples/error-handling.roc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Model : {}
1313

1414
program = { init!, respond! }
1515

16-
init! : {} => Try(Model, [Exit(I64), ..])
17-
init! = |{}| Ok({})
16+
init! : () => Try(Model, [Exit(I64), ..])
17+
init! = || Ok({})
1818

1919
AppError : [
2020
EnvVarNotSet(Str),

examples/file-accessed-modified-created-time.roc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Model : {}
1414

1515
program = { init!, respond! }
1616

17-
init! : {} => Try(Model, [Exit(I64), ..])
18-
init! = |{}| {
17+
init! : () => Try(Model, [Exit(I64), ..])
18+
init! = || {
1919
result = || {
2020
file = "LICENSE"
2121

examples/file-permissions.roc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Model : {}
1313

1414
program = { init!, respond! }
1515

16-
init! : {} => Try(Model, [Exit(I64), ..])
17-
init! = |{}| {
16+
init! : () => Try(Model, [Exit(I64), ..])
17+
init! = || {
1818
result = || {
1919
file = "LICENSE"
2020

examples/file-read-buffered.todoroc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ app [Model, init!, respond!] { pf: platform "../platform/main.roc" }
33
import pf.File
44
import pf.Http exposing [Request, Response]
55

6-
# To run this example: check the README.md in this folder
6+
# To run this example: check the root README.md
77

88
# # Buffered File Reading
99
#
@@ -26,8 +26,8 @@ ReadSummary : {
2626
}
2727

2828
# We only read the file once in `init`.
29-
init! : {} => Result Model [Exit I32 Str]_
30-
init! = |{}|
29+
init! : () => Result Model [Exit I32 Str]_
30+
init! = ||
3131
reader = File.open_reader!("LICENSE")?
3232

3333
process_line!(reader, { lines_read: 0, bytes_read: 0 })
@@ -53,4 +53,4 @@ process_line! = |reader, { lines_read, bytes_read }|
5353
)
5454

5555
Err(err) ->
56-
Err(ErrorReadingLine(Inspect.to_str(err)))
56+
Err(ErrorReadingLine(Inspect.to_str(err)))

examples/file-read.roc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import pf.File
77
import pf.Http
88
import http.Response
99

10-
# To run this example: check the README.md in this folder
10+
# To run this example: check the root README.md
1111

1212
Model : {}
1313

1414
program = { init!, respond! }
1515

16-
init! : {} => Try(Model, [Exit(I64), ..])
17-
init! = |{}| Ok({})
16+
init! : () => Try(Model, [Exit(I64), ..])
17+
init! = || Ok({})
1818

1919
respond! : Http.Request, Model => Try(Http.Response, [ServerErr(Str), ..])
2020
respond! = |_request, _model|

0 commit comments

Comments
 (0)