Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions examples/basic.roc
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/1.0.0/AnZoxzoGPtSGQ15EQh6pBeeaHJ7aizP9MQhK81dES3Uq.tar.zst",
path: "../package/main.roc",
}

import pf.Stdout
import path.Path

main! : List(Str) => Try({}, [Exit(I32), StdoutErr(Str), ..])
main! = |_args| {
main! = |_| {
file_path = Path.join("src", "main.roc")
Stdout.line!(Path.display(file_path))?
echo!("${Path.display(file_path)}\n")
Ok({})
}
7 changes: 2 additions & 5 deletions examples/tests.roc
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/1.0.0/AnZoxzoGPtSGQ15EQh6pBeeaHJ7aizP9MQhK81dES3Uq.tar.zst",
path: "../package/main.roc",
}

import pf.Stdout
import path.Path

quoted_path : Path.Path
quoted_path = "config.txt"

main! : List(Str) => Try({}, [Exit(I32), StdoutErr(Str), ..])
main! = |_args| {
Stdout.line!("Run `roc test examples/tests.roc` to exercise the path package examples.")?
main! = |_| {
echo!("Run `roc test examples/tests.roc` to exercise the path package examples.\n")
Ok({})
}

Expand Down
6 changes: 3 additions & 3 deletions package/Path.roc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Path :: [
Err(NotFound) => Ok(path)
}
}
}
}

## Returns the filename extension without the leading dot.
ext : Path -> Try(Path, [IsDirPath, EndsInDots])
Expand Down Expand Up @@ -222,7 +222,7 @@ utf16_to_utf8 = |remaining, out, index|

[unit, .. as rest] =>
utf16_to_utf8(rest, append_code_point_utf8(out, U16.to_u32(unit)), index + 1)
}
}

utf16_to_utf8_lossy : List(U16) -> List(U8)
utf16_to_utf8_lossy = |u16s| utf16_to_utf8_lossy_help(u16s, [])
Expand All @@ -245,7 +245,7 @@ utf16_to_utf8_lossy_help = |remaining, out|

[unit, .. as rest] =>
utf16_to_utf8_lossy_help(rest, append_code_point_utf8(out, U16.to_u32(unit)))
}
}

append_code_point_utf8 : List(U8), U32 -> List(U8)
append_code_point_utf8 = |out, code_point|
Expand Down
Loading