Skip to content

Commit fcd7ac7

Browse files
committed
format
1 parent 812f204 commit fcd7ac7

File tree

7 files changed

+29
-19
lines changed

7 files changed

+29
-19
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
app [main] {
22
pf: platform "../../../platforms/go-basic-cli/main.roc",
3+
lib: "./Lib/main.roc",
34
}
4-
import Lib.Display exposing [str, matrix]
5+
import lib.Display exposing [str, matrix]
56
main : Str
67
main = str(matrix [261, 23])
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
app [main] {
22
pf: platform "../../../platforms/go-basic-cli/main.roc",
3+
lib: "./Lib/main.roc",
34
}
4-
import Lib.Hello as Hello
5+
import lib.Hello
56
main : Str
6-
main = Hello.str
7+
main = Hello.str "Go"
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
app [main!] {
22
pf: platform "../../../platforms/rust-basic-cli/platform/main.roc",
3-
lib: "../../../lib/main.roc"
3+
lib: "./Lib/main.roc",
44
}
55
import lib.Hello
66
import pf.Stdout
7+
language = "Rust"
78
main! : {} => Result {} _
89
main! = |{}|
9-
Stdout.line!(Hello.str)?
10-
Stdout.line!("Roc ❤️ Rust")?
10+
Stdout.line!(Hello.str language)?
11+
Stdout.line!(Str.join_with(["Roc ❤️", language], " "))?
1112
Ok({})

pkgs/roc/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib/format.sh

pkgs/roc/lib/Hello.roc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ module [str]
22
import Square exposing [f64]
33
num : F64
44
num = 8192.0125
5-
str : Str
6-
str = Str.join_with(
7-
[
8-
"Roc <3 Go!",
9-
Str.join_with([Num.to_str(num), "^2=", Num.to_str(f64(num))], ""),
10-
"This is a Roc application running on Go.",
11-
"It imports a Roc module and calls a function from it.",
12-
],
13-
"\n",
14-
)
5+
str : Str -> Str
6+
str = |language|
7+
Str.join_with(
8+
[
9+
Str.join_with(["Roc loves", language], " "),
10+
Str.join_with([Num.to_str(num), "^2=", Num.to_str(f64(num))], ""),
11+
Str.join_with(["This is a Roc application running on ", language, "."], ""),
12+
"It imports a Roc module and calls a function from it.",
13+
],
14+
"\n",
15+
)

pkgs/roc/lib/format.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
shopt -s globstar nullglob
4+
files=(**/*.roc *.roc)
5+
roc format "${files[@]}"

pkgs/roc/lib/main.roc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package [
2-
Display,
3-
Hello,
4-
Square
2+
Display,
3+
Hello,
4+
Square,
55
] {}

0 commit comments

Comments
 (0)