Skip to content

Commit fba51bb

Browse files
feat: Init host module
1 parent 9453819 commit fba51bb

5 files changed

Lines changed: 421 additions & 47 deletions

File tree

Cargo.lock

Lines changed: 304 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/hello.roc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
app [main!] { pf: platform "../platform/main.roc" }
22

3+
import pf.Host
34
import pf.Stdout
45

5-
main! : List(Str) => Try({}, [Exit(I32)])
6-
main! = |_args| {
7-
Stdout.line!("Hello from basic-cli!")
8-
Ok({})
6+
main! : Host => Try({}, [Exit(I32)])
7+
main! = |host| {
8+
Stdout.line!("Hello from basic-cli!")
9+
args = host.args!()
10+
Stdout.line!("${Str.inspect(args)}")
11+
Ok({})
912
}

platform/Host.roc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Host := {
2+
args : List(Str),
3+
}.{
4+
## Returns the arguments that this program was started with.
5+
args! : Host => List(Str)
6+
}

0 commit comments

Comments
 (0)