Welcome!
What are you personally curious about in Roctoberfest? Do you expect to make time for multiple/regular sessions? Did you already do Advent of Code 2021?
What questions do you have for the Roc veterans here?
Hello!
First time doing advent of code :sweat_smile: and I'd love to maybe stream some sessions trying to tackle it using Roc.
I could see streaming definitely being valuable, particularly to help us find all friction points.
I did a few of them in BQN....but i think the solutions will be different enough that it is no big deal. Will be interesting to try this in Roc.
One question: is the plan to collect feedback via threads in this topic?
I had to ln -s c++/* .
inside /opt/homebrew/opt/llvm@13/lib
to make it work
Hi, tried to install roc
I'm on MacOS 11, Intel
Getting
Referenced from: /Users/Sebastian/Downloads/roc_nightly-macos_x86_64-2022-10-01-2b91154/./roc (which was built for Mac OS X 12.0)
Expected in: /usr/lib/libc++.1.dylib
I can't upgrade to 12, because my laptop is too old
So it seems a build for MacOS 11 would be great to have
ah, I was gonna say I could make you an 11 build, but my macOS Intel laptop is on 12 already :confounded:
maybe there could be one of these for macos 11 https://github.com/roc-lang/roc/blob/main/.github/workflows/nightly_macos_x86_64.yml?
I suspect this will be a common issue - people stuck in Macos 11
:thinking: if we did it for macOS 11 only, would that binary Just Work on 12?
or would two different binaries be necessary
because I just ran into this: how would I combine Effect
s which might fail with pure functions which return Result
?
Specifically, I'm reading a line and want to convert the line to a Nat
, which might fail. Is there a nicer way than matching the result and returning Task.succeed
and Task.fail
?
Also, is there a way to detect when Stdin.line
is done with the input? I would try and check for EOF
, but since I'm "stuck" on the first question and already here I though I might ask this as well.
The question are specific to the cli-plaform i guess?
Is there a nicer way than matching the result and returning Task.succeed and Task.fail?
I think some variant of the task module had Task.fromResult
, but I don't think it is in the cli platform variant. Should be easy enough to write the function once and use it multiple times.
Should be doable with a when
clause. Something like:
line <- Stdin.line |> Task.await
when Str.toI64 line is
Ok num -> Task.succeed num
Err _ -> Task.fail SomeErr
is there a way to detect when Stdin.line is done with the input?
Looks like the platform isn't setup for this yet. I am pretty sure it will panic if Stdin runs out of data. That is probably something we need to fix. Make it return a Result Str of some sort. That is probably a good advent of code related issue to fix.
that's basically what i did. i might extract my own fromResult
i guess.
I think I found a... bug in the roc typechecker?
I'm basically doing a recursive task function (simplified):
myTask : Task Nat <the error type> <the effects type>
myTask =
nextValue <- await readNat
if <some condition> then
myTask
else
Task.succeed <return value>
Running roc check
on this file hangs. maybe indefinitely, maybe for a long time.
I know there's Task.loop
which does exactly this looping, and that might work, but it seems that this should not be unresolvable
Can you post an issue to github with your roc code? Would be good for a repro.
Maybe we have a issue with using a task in a recursive way....not sure.
hmm... I created a minimal example to post to github, and now I'm getting a compiler panic saying that something's not implemented for InvalidCycle
, which seems more intentional. Now I'm wondering if that's a different problem than the hang...
nevermind, it just doesn't always hang O.o
What am I doing wrong? I solved day 1 but got stuck in refactoring it for tidiness. I've removed all of my parsing and calculating and it's still angry:
app "1a"
packages { pf: "../roc/examples/interactive/cli-platform/main.roc" }
imports [
pf.File,
pf.Path,
pf.Program.{ Program },
pf.Stdout,
pf.Task,
]
provides [main] to pf
main =
Task.attempt solve exit
|> Program.noArgs
solve =
read =
"1a_input.txt"
|> Path.fromStr
|> File.readUtf8
input <- Task.await read
input
|> Stdout.line
exit = \result ->
code = when result is
Ok _ -> 0
Err _ -> 1
Task.succeed {}
|> Program.exit code
[jan@framey roctoberfest]$ export RUST_BACKTRACE=1 && roc dev 1a.roc
roc: /lib64/libtinfo.so.6: no version information available (required by roc)
🔨 Rebuilding platform...
thread 'main' panicked at 'not yet implemented: Report a file open error', src/lib.rs:247:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped)
[jan@framey roctoberfest]$
Are you sure to have a file named 1a_input.txt
?
I'll try out making macos 11(x86_64) nightlies.
We should probably make a separate topic for every question, zulip works best that way :)
@Ghislain ! I forgot to change my file name from _data... :face_palm:
We should have better behaviour than this for a missing file though!
Sorry for being dumb/blind, where do I find the tasks of each day? :grinning_face_with_smiling_eyes:
There are no dumb questions here :) It was easy to miss, here you go: https://adventofcode.com/2021
@Anton thanks, mate! :big_smile:
Last updated: Jul 06 2025 at 12:14 UTC