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
2 changes: 1 addition & 1 deletion .roc-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2026-09-19-d025939
nightly-2026-09-28-9927ba8
19 changes: 15 additions & 4 deletions ci_scripts/expect_scripts/ErrorHandlingRealWorld.exp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@
# uncomment line below for debugging
# exp_internal 1

set timeout 7
# Generous timeout: this example does a real HTTP request
set timeout 30

source ./ci_scripts/expect_scripts/shared-code.exp

set env(HELLO) 1

spawn ./examples/ErrorHandlingRealWorld/main "https://www.roc-lang.org" roc.html

expect "Done\r\n" {
expect eof {
check_exit_and_segfault
expect {
"Done\r\n" {
expect eof {
check_exit_and_segfault
}
}
timeout {
puts stderr "\nError: timed out after $timeout seconds waiting for \"Done\"."
exit 1
}
eof {
puts stderr "\nError: program exited before printing \"Done\". wait status: [wait]"
exit 1
}
}

Expand Down
2 changes: 1 addition & 1 deletion ci_scripts/expect_scripts/ImportPackageFromModule.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source ./ci_scripts/expect_scripts/shared-code.exp
spawn ./examples/ImportPackageFromModule/main

expect {
-re {Ok\(\["h", "e", "l", "l", "o"\]\)\r\n} {
-re {\["h", "e", "l", "l", "o"\]\r\n} {
expect eof {
check_exit_and_segfault
}
Expand Down
2 changes: 1 addition & 1 deletion examples/AllSyntax/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ match_tag_union_advanced = |try|

Err(_) =>
"Unknown error"
}
}

multiline_str : U64 -> Str
multiline_str = |number|
Expand Down
7 changes: 3 additions & 4 deletions examples/CommandLineArgsFile/main.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Run with `roc ./examples/CommandLineArgsFile/main.roc -- examples/CommandLineArgsFile/input.txt`
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
roc: "nightly-2026-09-19-d025939",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
roc: "nightly-2026-09-28-9927ba8",
}

import cli.Stdout
Expand All @@ -10,8 +10,7 @@ import cli.File
import cli.Path

run! = |args| {
# get the second argument, the first is the executable's path
first_arg = List.get(args, 1) ? |_| ZeroArgsGiven
first_arg = List.get(args, 0) ? |_| ZeroArgsGiven

reader = File.open_reader!(Path.from_os_str(first_arg)) ? |err| FileReadFailed(first_arg, err)
file_first_line_utf8 = reader.read_line!() ? |err| FileReadFailed(first_arg, err)
Expand Down
4 changes: 2 additions & 2 deletions examples/Commands/main.roc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
roc: "nightly-2026-09-19-d025939",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
roc: "nightly-2026-09-28-9927ba8",
}

import cli.Stdout
Expand Down
2 changes: 1 addition & 1 deletion examples/EncodeDecode/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ItemKind := [
}
}

parser_for : encoding -> (state -> Try({ value : ItemKind, rest : state }, [TooShort, InvalidJson(Str), ..]))
parser_for : encoding -> (state -> Try({ value : ItemKind, rest : state }, [TooShort, InvalidJson(Str)]))
where [
encoding.parse_u32 : encoding, state -> Try({ value : U32, rest : state }, [InvalidJson(Str)]),
]
Expand Down
2 changes: 1 addition & 1 deletion examples/ErrorHandlingBasic/ErrorHandlingBasic.roc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Person : { first_name : Str, last_name : Str, birth_year : U16 }

parse_person : Str -> Try(Person, [InvalidSentenceFormat(Str), InvalidNameFormat(Str), InvalidBirthYearFormat(Str), ..])
parse_person : Str -> Try(Person, [InvalidSentenceFormat(Str), InvalidNameFormat(Str), InvalidBirthYearFormat(Str)])
parse_person = |line| {
{ before: full_name, after: birth_year_str } =
# The NotFound error is not very informative, so we discard it with `_` and provide our own.
Expand Down
6 changes: 3 additions & 3 deletions examples/ErrorHandlingRealWorld/main.roc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
roc: "nightly-2026-09-19-d025939",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
roc: "nightly-2026-09-28-9927ba8",
}

import cli.Stdout
Expand Down Expand Up @@ -52,7 +52,7 @@ run! = |args| {

parse_args! = |args| {
match args {
[_, first_arg, second_arg, ..] => {
[first_arg, second_arg, ..] => {
url = OsStr.display(first_arg)
Ok({ url, output_path: Path.from_os_str(second_arg) })
}
Expand Down
6 changes: 3 additions & 3 deletions examples/HelloWeb/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ program = { init!, respond!, shutdown! }
# generate css by running `tailwindcss`...
# In this case we don't have anything to initialize, so we use the default
# config.
init! : () => Try({ config : Server.Config, context : Context }, [Exit(I64), ..])
init! : () => Try({ config : Server.Config, context : Context }, [Exit(I64)])
init! = || Ok({ config: Server.default_config, context: {} })

respond! : Server.Request, Context => Try(Server.Outcome, [ServerErr(Str), ..])
respond! : Server.Request, Context => Try(Server.Outcome, [ServerErr(Str)])
respond! = |_request, _context|
Ok(
Server.respond(
Expand All @@ -27,5 +27,5 @@ respond! = |_request, _context|
),
)

shutdown! : Server.ShutdownReason, Context => Try({}, [Exit(I64), ..])
shutdown! : Server.ShutdownReason, Context => Try({}, [Exit(I64)])
shutdown! = |_reason, _context| Ok({})
6 changes: 3 additions & 3 deletions examples/ImportPackageFromModule/main.roc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### start snippet header
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
unicode: "https://github.com/roc-lang/unicode/releases/download/2.0.0/9ZvqNzsNkpqFmGTeATAY3BNBD7mP41jqZx2w2N19tBvh.tar.zst",
roc: "nightly-2026-09-19-d025939",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
unicode: "https://github.com/roc-lang/unicode/releases/download/4.2.0/4W8SHzvwet9hH9qZewJ1J1CVQoH7YKA6zyijWFTB3y1w.tar.zst",
roc: "nightly-2026-09-28-9927ba8",
}

### end snippet header
Expand Down
2 changes: 1 addition & 1 deletion examples/Json/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ main! = |args| {
\\ "width": 800
\\ }
\\}
}
}

decoded : Try(ImageRequest, _)
decoded = Json.parse(input_str)
Expand Down
6 changes: 3 additions & 3 deletions examples/LoopEffect/main.roc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
roc: "nightly-2026-09-19-d025939",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
roc: "nightly-2026-09-28-9927ba8",
}

import cli.Stdin
Expand Down Expand Up @@ -30,7 +30,7 @@ run! = || {
Stdout.line!("Sum: ${sum.to_str()}")
}

main! : List(OsStr) => Try({}, [Exit(I32), ..])
main! : List(OsStr) => Try({}, [Exit(I32)])
main! = |_args| {
match run!() {
Ok({}) => Ok({})
Expand Down
6 changes: 3 additions & 3 deletions examples/Parser/main.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/1.0.2/FrnJ4RGDKpQyoDyESNoBwFNviY4ZGbMVLnUjW9tvSRjk.tar.zst",
roc: "nightly-2026-09-19-d025939",
roc: "nightly-2026-09-28-9927ba8",
}

import cli.Stdout
Expand All @@ -12,7 +12,7 @@ import parser.String exposing [parse_str, codeunit, any_codeunit]

default_input_str = "ABRACADABRA"

main! : List(OsStr) => Try({}, [Exit(I32), ..])
main! : List(OsStr) => Try({}, [Exit(I32)])
main! = |args| {
input_str = args.map(OsStr.display).get(1) ?? default_input_str

Expand Down
7 changes: 3 additions & 4 deletions examples/RandomNumbers/main.roc
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
rand: "https://github.com/kili-ilo/roc-random/releases/download/0.9.2/2ZXLX8WRqrosGu1V3VL5aXqgtfTRvJmjFPx8a26ecVmc.tar.zst",
roc: "nightly-2026-09-19-d025939",
roc: "nightly-2026-09-28-9927ba8",
}

import cli.Stdout
import cli.OsStr
import rand.Random

main! : List(OsStr) => Try({}, [Exit(I32), ..])
main! : List(OsStr) => Try({}, [Exit(I32)])
main! = |_args| {

# Print a list of 10 random numbers.
numbers_str =
random_numbers
Expand Down
2 changes: 1 addition & 1 deletion examples/SafeMath/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ expect safe_variance([4, 22, 99, 204, 18, 20]) == Ok(5032.138888888888888888)
expect safe_variance([46, 69, 32, 60, 52, 41]) == Ok(147.666666666666666666)

# The following function should soon be available in the Roc builtins
times_try : Dec, Dec -> Try(Dec, [Overflow, ..])
times_try : Dec, Dec -> Try(Dec, [Overflow])
times_try = |a, b| {
result = a.times_saturated(b)
if result == Dec.lowest or result == Dec.highest {
Expand Down
4 changes: 2 additions & 2 deletions examples/Snake/main.roc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
roc: "nightly-2026-09-19-d025939",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
roc: "nightly-2026-09-28-9927ba8",
}

import cli.Stdin
Expand Down
4 changes: 2 additions & 2 deletions examples/SortStrings/main.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app [main!] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.2/9zUBxb1LtXYVc4eR4hAtd1WQDwBYDhM6HQdZz1UFCm2m.tar.zst",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.23.0/GNN5tt2gKdX4dhawg4915C4YB193woHFdcCkz31fhGxv.tar.zst",
ascii: "https://github.com/Hasnep/roc-ascii/releases/download/v0.3.1/1PCTQ0tzSijxfhxDg1k_yPtfOXiAk3j283b8EWGusVc.tar.br",
roc: "nightly-2026-09-19-d025939",
roc: "nightly-2026-09-27-a3ce7f1",
}

import cli.Stdout
Expand Down
4 changes: 2 additions & 2 deletions examples/TryOperatorDesugaring/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ main! = |_| {
}

### start snippet question
parse_name_and_year : Str -> Try({ name : Str, birth_year : U16 }, [BadFormat, BadNumStr, ..])
parse_name_and_year : Str -> Try({ name : Str, birth_year : U16 }, [BadFormat, BadNumStr])
parse_name_and_year = |str| {
{ before: name, after: birth_year_str } = str.split_first(" was born in ") ? |_| BadFormat
birth_year = U16.from_str(birth_year_str)?
Expand All @@ -15,7 +15,7 @@ parse_name_and_year = |str| {
### end snippet question

### start snippet desugared
parse_name_and_year_try : Str -> Try({ name : Str, birth_year : U16 }, [BadFormat, BadNumStr, ..])
parse_name_and_year_try : Str -> Try({ name : Str, birth_year : U16 }, [BadFormat, BadNumStr])
parse_name_and_year_try = |str| {
match str.split_first(" was born in ") {
Err(_) => Err(BadFormat)
Expand Down
Loading