Stream: roctoberfest

Topic: Questions


view this post on Zulip jan kili (Sep 30 2022 at 11:58):

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?

view this post on Zulip Georges Boris (Sep 30 2022 at 13:33):

Hello!

First time doing advent of code :sweat_smile: and I'd love to maybe stream some sessions trying to tackle it using Roc.

view this post on Zulip Anton (Sep 30 2022 at 13:41):

I could see streaming definitely being valuable, particularly to help us find all friction points.

view this post on Zulip Brendan Hansknecht (Sep 30 2022 at 14:16):

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.

view this post on Zulip Brendan Hansknecht (Sep 30 2022 at 14:20):

One question: is the plan to collect feedback via threads in this topic?

view this post on Zulip Shritesh Bhattarai (Oct 02 2022 at 22:48):

I had to ln -s c++/* . inside /opt/homebrew/opt/llvm@13/lib to make it work

view this post on Zulip Sebastian Porto (Oct 02 2022 at 22:48):

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

view this post on Zulip Richard Feldman (Oct 02 2022 at 22:52):

ah, I was gonna say I could make you an 11 build, but my macOS Intel laptop is on 12 already :confounded:

view this post on Zulip Sebastian Porto (Oct 02 2022 at 22:54):

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?

view this post on Zulip Sebastian Porto (Oct 02 2022 at 22:55):

I suspect this will be a common issue - people stuck in Macos 11

view this post on Zulip Richard Feldman (Oct 02 2022 at 22:56):

:thinking: if we did it for macOS 11 only, would that binary Just Work on 12?

view this post on Zulip Richard Feldman (Oct 02 2022 at 22:56):

or would two different binaries be necessary

view this post on Zulip Gabriel Pickl (Oct 02 2022 at 23:12):

because I just ran into this: how would I combine Effects 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?

view this post on Zulip Brendan Hansknecht (Oct 02 2022 at 23:24):

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.

view this post on Zulip Brendan Hansknecht (Oct 02 2022 at 23:28):

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

view this post on Zulip Brendan Hansknecht (Oct 02 2022 at 23:30):

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.

view this post on Zulip Gabriel Pickl (Oct 02 2022 at 23:33):

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

view this post on Zulip Brendan Hansknecht (Oct 02 2022 at 23:37):

Can you post an issue to github with your roc code? Would be good for a repro.

view this post on Zulip Brendan Hansknecht (Oct 02 2022 at 23:38):

Maybe we have a issue with using a task in a recursive way....not sure.

view this post on Zulip Gabriel Pickl (Oct 02 2022 at 23:44):

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...

view this post on Zulip Gabriel Pickl (Oct 02 2022 at 23:48):

nevermind, it just doesn't always hang O.o

view this post on Zulip Gabriel Pickl (Oct 02 2022 at 23:52):

issue

view this post on Zulip jan kili (Oct 03 2022 at 05:04):

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]$

view this post on Zulip Ghislain (Oct 03 2022 at 08:42):

Are you sure to have a file named 1a_input.txt?

view this post on Zulip Anton (Oct 03 2022 at 10:06):

I'll try out making macos 11(x86_64) nightlies.

view this post on Zulip Anton (Oct 03 2022 at 10:08):

We should probably make a separate topic for every question, zulip works best that way :)

view this post on Zulip jan kili (Oct 03 2022 at 12:56):

@Ghislain ! I forgot to change my file name from _data... :face_palm:

view this post on Zulip Brian Carroll (Oct 03 2022 at 20:24):

We should have better behaviour than this for a missing file though!

view this post on Zulip Johannes (Oct 05 2022 at 09:31):

Sorry for being dumb/blind, where do I find the tasks of each day? :grinning_face_with_smiling_eyes:

view this post on Zulip Anton (Oct 05 2022 at 09:37):

There are no dumb questions here :) It was easy to miss, here you go: https://adventofcode.com/2021

view this post on Zulip Johannes (Oct 05 2022 at 09:38):

@Anton thanks, mate! :big_smile:


Last updated: Jul 06 2025 at 12:14 UTC