As you know we are getting close to Advent of Code -- and should have the compiler in a state that we can use it (for those brave enough).
If you have some time and would like to help, it would be great if you could try out the new compiler using a test platform and report any bugs or issues you find.
We've just started adding the builtins - so many functions are just missing an implementation. Feel free to make a PR if you can.
Here is a video I clipped showing how you can use the new compiler today.
It's using the fx test platform, so only has Stdio effects available... and only works when built locally (not from a URL release) -- but that's all you need to get started solving AoC puzzles and trying out the new static dispatch and syntax.
We're resolving bugs in a tight loop (think hours not days) right now, so if you find any issues I would suggest letting us know in zulip and remember to sync with main as PR's land.
Looking forward to working with you all on Roc and preparing for AoC again this year :smile:
Is there another step here to build libhost.a on a non-windows platform? I'm running into this failing-to-find-host-path error case locally on linux.
Hmm, did you run zig build test?
Yeah; maybe some test is being skipped? I got 1533 passed on roc version debug-9e509c53.
I will try it on linux later today.
I noticed fx_platform_test.zig now. If I run zig build test -- --test-filter 'fx platform' no tests are run, so I think that's getting skipped for some reason.
It needs to be 'fx_platform', that works for me, does it work for you?
I was able to reproduce the issue on linux
I hit that error as well on NixOs. Did zig build and zig build test before. Then with zig-out/bin/roc test/fx/app.roc I get:
error: Failed to resolve platform spec './platform/main.roc': error.PlatformNotSupported
I also hit this issue on NixOS. build.zig has a check like target.query.isNativeCpu() and target.query.isNativeOs() and target.query.isNativeAbi() on line 816 and that'll be false on my machine since I'm using native CPU, native OS, but not native ABI (it's using musl not glibc). So I switched that to is_native (an existing variable with exactly this distinction). However, the tests fail and I'll attach the output.
I'll try to take care of this issue tomorrow.
I'm blown away by how fast ./zig-out/bin/roc test/fx/app.roc is. It just goes BRRRT! Can't wait to use this compiler for everything... everything.
Are there any WIP docs I can use while trying this out, or should I just look at the source code to figure out what’s available and where I can help out? I just built the compiler on macOS, and that part went great. :slight_smile:
I'm going to try to post some tonight
I tried to run a simple "hello world" program with the compiler using the following Roc file:
app [main!] { pf: platform "/Users/kevin/src/roc/test/fx/platform/main.roc" }
import pf.Stdout
main! = || {
Stdout.line!("Hello, World!")
}
But running roc year2024day01.roc produced the following error message:
~/prj/advent-of-code $ roc year2024day01.roc
Roc crashed: Error evaluating from shared memory: TypeMismatch
error: Failed to run with POSIX fd inheritance: error.ProcessExitedWithError
Am I doing something silly here? I'm running on the latest version of macOS and have the compiler running at debug-c442c8a0.
if you have the repo checked out, what happens if you do (from the repo root) roc test/fx/app.roc?
Richard Feldman said:
if you have the repo checked out, what happens if you do (from the repo root)
roc test/fx/app.roc?
That seems to work fine.
~/src/roc (main) $ zig-out/bin/roc test/fx/app.roc
Hello from stdout!
Line 1 to stdout
Line 2 to stderr
Line 3 to stdout
Error from stderr!
hm, maybe it's unhappy about the absolute path?
for the platform location
What if you rename the file to app.roc (rename the existing one)? I tried a few things and the filename seems to have an impact for me.
It doesn't seem like a relative path helped. I changed the platform path to ../../src/roc/test/fx/platform/main.roc and got the same error. Renaming the file to app.roc did not work either.
What did work was coping the platform into the root of the directory where the file is and then reference it using a relative path (app [main!] { pf: platform "./platform/main.roc" }).
Perhaps I was mistaken in thinking I could reference a platform outside my project directory?
To give context about the filename:
./zig-out/bin/roc test/fx/appc.roc
error: Child process /home/niclas/.cache/roc/43d450a451cacf424d42033893679acf/temp/roc-tmp-22donbk0q9xGfZH0fwb5a2jfUHqhJGXb/roc_run_349899816 killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)
error: Failed to run with POSIX fd inheritance: error.ProcessKilledBySignal
./zig-out/bin/roc test/fx/app.roc
Hello, World!
Same file contents
I'll take a look at the relative path thing
the name appc.roc works for me, but that is WILD
Yeah, my wife tells me I'm pretty crazy
Richard Feldman said:
I'll take a look at the relative path thing
Worth noting is that it only seems to work when the platform starts with ./path/to/platform. I tried moving the file from <PROJECT_ROOT>/year2024day01.roc into <PROJECT_ROOT>/year2024/day01.roc but then I got the same error because the platform path started with ../ now.
➜ roc_zig git:(main) ✗ cp test/fx/appc.roc test/fx/app.roc
➜ roc_zig git:(main) ✗ bat test/fx/app.roc
─────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: test/fx/app.roc
─────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ app [main!] { pf: platform "./platform/main.roc" }
2 │
3 │ import pf.Stdout
4 │ import pf.Stderr
5 │
6 │ main! = || {
7 │ Stdout.line!("Hello from stdout!")
8 │ Stdout.line!("Line 1 to stdout")
9 │ Stderr.line!("Line 2 to stderr")
10 │ Stdout.line!("Line 3 to stdout")
11 │ Stderr.line!("Error from stderr!")
12 │ }
─────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
➜ roc_zig git:(main) ✗ bat test/fx/appc.roc
─────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: test/fx/appc.roc
─────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ app [main!] { pf: platform "./platform/main.roc" }
2 │
3 │ import pf.Stdout
4 │ import pf.Stderr
5 │
6 │ main! = || {
7 │ Stdout.line!("Hello from stdout!")
8 │ Stdout.line!("Line 1 to stdout")
9 │ Stderr.line!("Line 2 to stderr")
10 │ Stdout.line!("Line 3 to stdout")
11 │ Stderr.line!("Error from stderr!")
12 │ }
─────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
➜ roc_zig git:(main) ✗ ./zig-out/bin/roc test/fx/app.roc
Hello from stdout!
Line 1 to stdout
Line 2 to stderr
Line 3 to stdout
Error from stderr!
➜ roc_zig git:(main) ✗ ./zig-out/bin/roc test/fx/appc.roc
error: Child process /home/niclas/.cache/roc/43d450a451cacf424d42033893679acf/temp/roc-tmp-MxVgzDoyVPsmTvDDcEvMe750Tm0mrDPP/roc_run_349899816 killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)
error: Failed to run with POSIX fd inheritance: error.ProcessKilledBySignal
idk man, my computer is drunk :joy:
is this on current main? so, 587c53210286757876478579d2c17cd59f834198
I just tried what @Niclas Ahden mentioned on my machine (M1 MBP on macOS 15.16.1) and ./zig-out/bin/roc test/fx/appc.roc ran without a problem on 587c53210286757876478579d2c17cd59f834198.
Nope, I was on df66010948. Pulled 587c532102, git clean -dfx, re-added this diff:
diff --git i/build.zig w/build.zig
index 57fb74fa51..d9d0c6bd4d 100644
--- i/build.zig
+++ w/build.zig
@@ -1044,7 +1044,7 @@ pub fn build(b: *std.Build) void {
const is_windows = target.result.os.tag == .windows;
// fx platform effectful functions test - only run when not cross-compiling
- if (target.query.isNativeCpu() and target.query.isNativeOs() and target.query.isNativeAbi()) {
+ if (is_native) {
// Create fx test platform host static library
const test_platform_fx_host_lib = createTestPlatformHostLib(
b,
Rebuilt with zig build, then:
./zig-out/bin/roc test/fx/app.roc
error: Child process /home/niclas/.cache/roc/8a126c1a3b33ced3831765bc6d91e1bc/temp/roc-tmp-LPoA9CbVzOVdzCLySvGz5YtBiD4lWT8i/roc_run_792223834 killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)
error: Failed to run with POSIX fd inheritance: error.ProcessKilledBySignal
I'll try the same on my Mac.
Works perfectly on the Mac (ARM). Not on NixOS (x86) sadly.
ok see if it works on this branch: https://github.com/roc-lang/roc/pull/8461
(I'm guessing probably still doesn't work on NixOS but relative paths should work better!)
Richard Feldman said:
ok see if it works on this branch: https://github.com/roc-lang/roc/pull/8461
I tried rebuilding the compiler but got:
test
└─ tests_summary
└─ run test fx_platform_test 12/13 passed, 1 failed
error: 'fx_platform_test.test.fx platform with dotdot starting path' failed: Run failed with exit code 1
STDOUT:
STDERR:
Roc crashed: Error evaluating from shared memory: TypeMismatch
error: Failed to run with POSIX fd inheritance: error.ProcessExitedWithError
/Users/kevin/src/roc/src/cli/test/fx_platform_test.zig:146:17: 0x1005c908b in test.fx platform with dotdot starting path (fx_platform_test)
return error.RunFailed;
^
error: while executing test 'fx_platform_test.test.fx platform checked directly finds sibling modules', the following test command failed:
./.zig-cache/o/8b01e086a989ec45c18eb3c0c3b150b3/fx_platform_test --cache-dir=./.zig-cache --seed=0x73d04778 --listen=-
Build Summary: 54/57 steps succeeded; 1 failed; 1590/1591 tests passed; 1 failed
test transitive failure
└─ tests_summary transitive failure
└─ run test fx_platform_test 12/13 passed, 1 failed
error: the following build command failed with exit code 1:
.zig-cache/o/cc6d41c01a0793b6188e07ef840af6b0/build /Users/kevin/.asdf/installs/zig/0.15.2/zig /Users/kevin/.asdf/installs/zig/0.15.2/lib /Users/kevin/src/roc .zig-cache /Users/kevin/.cache/zig --seed 0x73d04778 -Za49efdac55e7b81a test
I could verify that the branch fixes the relative path issue. No build error unlike Kevin.
(and it still doesn't work on NixOS as expected)
@Kevin Hovsäter what OS are you running?
Richard Feldman said:
Kevin Hovsäter what OS are you running?
M1 MBP on macOS 15.16.1.
M1 MBP on macOS 26.1 (25B78)
so weird! I don't know what the issue is
FYI here is the WIP tutorial I'm working on - just have the very basics so far https://gist.github.com/rtfeldman/f46bcbfe5132d62c4095dfa687bb9aa4
we do actually have bundled platforms working, so in theory we could package up the test/fx/ platform for all the different OSes and distribute it, but we should probably try to get NixOS working first
@Kevin Hovsäter if you do zig build without running tests, and then run the compiled roc manually, does that work?
Richard Feldman said:
so weird! I don't know what the issue is
I'm heading to bed, but I can try to investigate further tomorrow!
Double-checking:
zig build test
✅ All 1591 tests passed.
I'm on x86_64-linux-gnu and experiencing the same issue.
Richard Feldman said:
FYI here is the WIP tutorial I'm working on - just have the very basics so far https://gist.github.com/rtfeldman/f46bcbfe5132d62c4095dfa687bb9aa4
Whether grabbing the nightly like in this tutorial or building from source, I can't get the fx platform to work either. Initially, I get
$ roc version
Roc compiler version release-fast-299268c2
$ roc test/fx/app.roc
error: Failed to resolve platform spec './platform/main.roc': error.PlatformNotSupported
After adjusting build.zig to actually build test/fx/platform/libhost.a, the error becomes
$ roc test/fx/app.roc
error: Child process /home/timob/.cache/roc/387646676cd876895a972bc305e43fc4/temp/roc-tmp-KBw2ppRjjpmtiooxunMoZ47aR77MhrJ5/roc_run_792223834 killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)
error: Failed to run with POSIX fd inheritance: error.ProcessKilledBySignal
I can't seem to usefully attach a debugger to anything, so my investigation unfortunately has had to stop here so far.
I'll try to debug that tonight
I tried fix-segfault/ca81b2916 but that didn't affect this issue. Happy to test more tomorrow, good night!
8 messages were moved from this topic to #contributing > Help prepare for AoC 2025 - Testing a platform from URL by Luke Boswell.
Anton said:
I'll try to take care of this issue tomorrow.
I have not looked into this yet, I'll prioritize it tomorrow.
The PlatformNotSupported error on linux should be fixed with PR#8490. Please give latest main a try again.
On linux on latest main, I'm now getting the ProcessKilledBySignal Isaac describes above when running zig build test (which is good!). I get what I assume is the same segfault when running ./zig-out/bin/roc test/fx/app.roc directly. If I use gdb like:
gdb ./zig-out/bin/roc
(gdb) run test/fx/app.roc
(gdb) backtrace
I get No stack., but I don't know if that's me doing something incorrect or not.
I'll check it out
PR#8497 is up to fix this
You may need to do git clean -fdx to delete old build artifacts.
zig build test and ./zig-out/bin/roc test/fx/app.roc now works on my ubuntu 24 machine on latest main :)
Can confirm on NixOS (x86). Sweet!
btw I'm expanding on this tutorial gist - I've now added some stuff on for loops, var, and block expressions: https://gist.github.com/rtfeldman/f46bcbfe5132d62c4095dfa687bb9aa4 (it's still WIP overall, but hoping to have it complete before Dec 1!)
Niclas Ahden said:
Can confirm on NixOS (x86). Sweet!
I tried getting the main branch to work on nix, but I don't know if I'm doing things the right way.
{
description = "A development environment for Roc projects";
inputs = {
# Define the roc input, pointing to the official GitHub repository
roc.url = "github:roc-lang/roc";
# Ensure nixpkgs follows the version used by the Roc repository for compatibility
nixpkgs.follows = "roc/nixpkgs";
};
outputs = { self, nixpkgs, roc }:
let
# Define the systems your flake will support
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
# Helper function to generate outputs for each system
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
devShells = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
rocPkgs = roc.packages.${system};
in
{
# Define the development shell
default = pkgs.mkShell {
buildInputs = [
rocPkgs.cli # Add the Roc CLI to the environment
];
# Optional: Add a shell hook for convenience, e.g., setting an environment variable
shellHook = ''
export ROC=roc
echo "Roc development environment loaded. Use the 'roc' command to get started."
'';
};
});
};
}
I get this error when running the main.roc from the gist for AOC:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst" }
import pf.Stdout
main! = |_args| {
Stdout.line!("Hello, World!")
Ok({})
}
Gives this when run:
$ roc main.roc
── INVALID EXTENSION SUFFIX in main.roc ────────────────────────────────────────
I tried to download from this URL:
https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst
However, this file's extension (.zst) is not a supported extension.
The supported extensions are .tar, .tar.gz and .tar.br
Tip: Check that you have the correct URL for this package/platform.
I think you may be using the old rust compiler. I'm not sure if we have a flake for the new zig compiler setup
I'm not sure if we have a flake for the new zig compiler
I'm working on it! https://github.com/roc-lang/roc/pull/8351
When creating a new folder somewhere on my disk for AoC, and adding the app.roc there. And changing the platform path to an absolute one, it seems roc doesn’t find the platform:
❯ roc app.roc
error: No platform found. Every Roc app requires a platform.
error: Failed to set up shared memory with ModuleEnv: error.NoPlatformFound
What am I missing?
I think this is a security feature
I would recommend you use a platform from a URL -- of which there is only one right now
https://github.com/lukewilliamboswell/roc-platform-template-zig/releases
Can you try using the example from here https://gist.github.com/rtfeldman/f46bcbfe5132d62c4095dfa687bb9aa4
I’m getting this with the url one:
❯ roc app.roc
-- TYPE MISMATCH ---------------------------------
This expression is used in an unexpected way:
┌─ app.roc:9:1
│
9 │ main! = || {
│ ^^^^^
It has the type:
({}) => { }
But the type annotation says it should have the type:
List(Str) => Try([Exit(I32)])
Found 1 error(s) and 0 warning(s) for app.roc.
thread 9141557 panic: reached unreachable code
???:?:?: 0x102a681cb in ??? (roc_run_1662736024)
???:?:?: 0x102a7362f in ??? (roc_run_1662736024)
???:?:?: 0x102a624e3 in ??? (roc_run_1662736024)
???:?:?: 0x102a6027f in ??? (roc_run_1662736024)
???:?:?: 0x102a5fce3 in ??? (roc_run_1662736024)
???:?:?: 0x1029c87eb in ??? (roc_run_1662736024)
???:?:?: 0x1029c96ef in ??? (roc_run_1662736024)
???:?:?: 0x18332ab97 in ??? (???)
???:?:?: 0x0 in ??? (???)
error: Child process /Users/piz/Library/Caches/roc/072c932d3be8db1509821ec0a451d264/temp/roc-tmp-INcgCagWvk2ArLrvuFFrTiOIL1N8raew/roc_run_1662736024 killed by signal: 6
error: Child process aborted (SIGABRT)
Is it because I’m using my roc build from main instead of the roc build from that same release?
The platform API is different, it passes args
ok I’ll read Richard post more
Try this
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst" }
import pf.Stdout
main! : List(Str) => Try({}, [Exit(I32)])
main! = |_args| {
Stdout.line!("Hello Roc!")
Ok({})
}
Oh, richard's notes around the main! part aren't right -- missing the |_args|
The first code block is correct. And notes incorrect indeed. Got it working by adding the _args and the Ok({}). Thanks
If I don’t add the Ok({}). The behavior is a little weird. It tells me the code doesn’t type check. Yet it runs anyway, print stuff, and crashes at the end.
Yep -- we run anyway even if there are type errors at compile time, they become runtime crashes
I just made this PR for modulus on integer types, since it might be very useful for AoC day 1. https://github.com/roc-lang/roc/pull/8528
Seems from_str will also be needed for numeric types, or at least for integer types to be able to solve day 1. And I think this one might be a bit too complicated to implement for me? I don’t know. Is someone looking into from_str functions already?
Seems
from_strwill also be needed for numeric types, or at least for integer types to be able to solve day 1.
Yes that makes sense
I don’t know. Is someone looking into
from_strfunctions already?
Not that I know of
I think this one might be a bit too complicated to implement for me?
Possibly, feel free to give it a try and let us know if/when it starts to get complicated.
PR for from_str: https://github.com/roc-lang/roc/pull/8529
I almost have a working AoC day1, but now having issues with a use after free ^^. Will try to simplify the example.
Hey everyone, i wanted to give roc a try and followed Richards tutorial above. I downloaded the windows nightly build (x86_64-2025-11-30) and added a main.roc file with the provided Hello World sample. I am running into a problem about a missing windows sdk, do i need to install anything else?
> .\roc.exe --version
Roc compiler version release-fast-77e8bbc1
> .\roc.exe main.roc
error: Failed to link executable: error.WindowsSDKNotFound
I am running this on a fairly standard Windows (11 Pro 25H2) installation. Let me know, how i can help debug the issue or if i should open an issue somewhere. I am very excited to give roc a try.
thanks! I wonder if we could reproduce this on CI somehow :thinking:
Likely not, github CI will be preconfigured with the right stuff
New nightlies already test on windows
Anton said:
Likely not, github CI will be preconfigured with the right stuff
We could set up our own server for this but I think once we solve the issues with new windows machines it will stay solved
@stephdin are you using the default powershell terminal?
For anyone interested... here is the relevant part of the code for this issue https://github.com/roc-lang/roc/blob/949102f53db7908d214925ae74af333aee1d95fc/src/cli/linker.zig#L264-L267
Yes, i am using Windows Terminal with PowerShell 7.5.4
This kind of issue is hard for us to debug because it requires a fresh Windows install. I think if you have developer tools installed or things already set up it can be hard to reproduce.
I think the issue is Windows can't find those libraries by default for some reason, even though I'm pretty sure they are on your system
Thank you for your answer, i will investigate why these libraries cannot be found. I have indeed some developer tools installed, maybe they mess with my setup
Can you try running the roc executable from within another shell? if you have Visual Studio for example from within there
On macOS (M1), I’m trying to get the current workaround to run using:
zig build roc
from the root of the freshly cloned (latest) Roc repository.
However, I’m getting the following error:
roc/build.zig.zon:2:14: error: expected string literal
.name = .roc,
^~~
Could anyone point out what I’m doing wrong?
What version of zig are you using? you need to be on 0.15.2
$ zig version
0.15.2
ah, I see – I'm currently on 0.11.0
thanks a lot, Luke!
Is there a function in your platform @Luke Boswell to read from a file? I think that’s my last missing piece
Otherwise, I will copy paste the whole input.
No effect to read from a file
It would be pretty easy to add one if you wanted though
I was just planning on keeping the template minimal(ish) to focus on the key parts -- with the timing of everything it was the only platform usable in time for AoC
Is importing strings from files implemented?
I'm not sure -- I don't think so
Folks we have a valid Roc solution :tada:
❯ roc day01.roc
Part 1 (demo): 3
Part 1: 1135
Part 2 (demo): 6
Part 2: 6558
error(gpa): memory address 0x101200040 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo
error(gpa): memory address 0x101260000 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo
Still a few issues as you can see ahah. And also quite slow to compute ^^. But it’s correct!
yeah the interpreter is not at all optimized for speed right now :laughing:
I'm sure we can make it a lot faster, and we're all set up to JIT if desired
Here for those interested in looking at it (spoiler!)
AoC day 01 solution in Roc
Roc is looking so good, thank you for sharing @Matthieu Pizenberg
Thanks for working on the language! Excited to see it mature this year!
thanks for helping it mature - there's no substitute for battle testing like this to find bugs! :smile:
There are a few things that did not work so I worked around by rewriting another way. I don’t remember all. Here is those that I remember:
Writing print! like this does not compile with the rest of the program (haven’t checked alone)
print! = |msg| msg.split_on("\n").for_each!(Stdout.line!)
I would have loved to be able to use ? directly in the for loop, but then propagating it in main! would still have needed another wrapper function like run! to unwrap and convert the various tags into the I32 error that the main expects. If possible, would be nice to have the main accept whatever tag in the error.
abs for integers. An easy one missing. Maybe a good first issue?
I think I hit some issues with the var at some point but I’m not 100% positive on that one. It seems there a few memory issues left. Good luck chasing those!
I'll jump on all of these tonight - I'm not really trying to save Advent of Code bugfixes for first contributions; I just want to unblock ASAP :smile:
btw we optimized the type of main! in basic_cli for being able to have ? inside main! Just Work - probably too late for Advent of Code to be changing the type signature of main! again, but it's good feedback to know that you independently ran into wanting this!
This is the signature for the template platform from your notes main! : List(Str) => Try({}, [Exit(I32)]) I thought that was good for that reason? or are we missing the open union in the tag?
I couldn't get an open union working there... but I think I just couldn't remember the syntax we landed on
yeah the open union is the key
in basic_cli it's something like [Exit(I32), .._others] in the new syntax (I'm not sure if that new syntax actually works though!)
If I comment my Ok in the run! function it gives me this error with the syntax for the open union:
run! = || {
print!("Part 1 (demo): ${part1!(demo_input.trim())?.to_str()}")
print!("Part 1: ${part1!(day_input.trim())?.to_str()}")
print!("Part 2 (demo): ${part2!(demo_input.trim())?.to_str()}")
print!("Part 2: ${part2!(day_input.trim())?.to_str()}")
#Ok({})
}
main! = |_args| {
match run!() {
Ok(_) => Ok({})
Err(_) => Err(1)
}
}
error:
❯ roc day01.roc
-- TYPE MISMATCH ---------------------------------
This expression is used in an unexpected way:
┌─ day01.roc:85:5
│
85 │ print!("Part 2: ${part2!(day_input.trim())?.to_str()}")
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It has the type:
{}
But I expected it to be:
[BadNumStr, Err([BadNumStr])][BadNumStr, BadNumStr]_others
Found 1 error(s) and 0 warning(s) for day01.roc.
Part 1 (demo): 3
Part 1: 3
Part 2 (demo): 6
Part 2: 6
Roc crashed: non-exhaustive match
we should also really allow [Exit(I32), ..] instead of [Exit(I32), .._others] because the former reads way better :laughing:
@Matthieu Pizenberg you would need to change the API in the platform/main.roc -- if you're running the zig template locally you could try it out
@Matthieu Pizenberg that's the old syntax, I think that error message is just out of date and printing the wrong thing
I thought about having a look. But I think I’ve already spent a bit too much time for now ^^
Is this still an actual way to get a new compiler? (build from the source code using Zig 0.15.2)
I found a message that there is a nightly build, but I did not find it.
Richard Feldman said:
btw I'm expanding on this tutorial gist - I've now added some stuff on
forloops,var, and block expressions: https://gist.github.com/rtfeldman/f46bcbfe5132d62c4095dfa687bb9aa4 (it's still WIP overall, but hoping to have it complete before Dec 1!)
This guide is probably what you are looking for. It is still mostly up to date (I think?), only thing you need to do to get it working is to update the platform url to the newest release.
Last updated: Dec 21 2025 at 12:15 UTC