Day 8 was frustrating, but not for Roc reasons - I just don't really like the problem that much. On the Roc side I found myself really reaching for a crash
/unreachable
function, which I wrote here - it's just not useful to model the data in such a specific way as to not have to use it, IMO. I think the parser I wrote was the most interesting part of today. The combinator library is coming along nicely
Also having to write two separate functions for get-or-crash for Dict and List (https://github.com/ayazhafiz/roc-advent-of-code/blob/28c22ef3a242e9915f22b005fa197aebe1d7971b/2021/day8.roc#L137-L145) had me reaching for higher kinds a bit.. but not enough for it to matter
Just read the first part of the problem. I can immediately see why it would be frustrating.
Just finished day 8. Was not horrid, but was definitely annoying: https://github.com/bhansconnect/roc-aoc-2021/blob/trunk/day8/part2.roc
One main thing that bit me was forgetting that ==
does not do what you would expect on a set. It compares the underlying lists in order rather than comparing the sets.
I forget what we decided about that :sweat_smile:
like whether ==
on sets and dictionaries should ignore insertion order, even though that would mean a == b
would not imply walk a state fn == walk b state fn
for dictionaries and sets
Since we are allowing user defined types to implement the Eq ability and get a custom ==
, we will also change ==
on sets and dictionaries to ignore insertion order.
I think that was more or less the last state of discussion
Of course we will have a insertion order perserving set and dict, so at least construction more clearly defines ordering.
https://github.com/ghigt/advent-of-code/blob/main/roc/day-8/part2.roc
This one was definitely not funny...
I find the need for an integrated editor, I've been lost several times in the algorithm.
Thanks to @Folkert de Vries I discovered that expect
can be helpful outside functions (waiting for issue 4093).
I still find coding in JS/TS easier because of the vscode help on current types. I find myself coding differently by easily "console.log
ing" each functions. In Roc, my brain is lazy on writing a long Dict
/Set
to tests function calls.
I like finding definition of functions in the repl
, but it fails on some calls (eg. Dict.get
, Dict.update
...). Would also be happy to have the doc associated with it :sweat_smile:
Last updated: Jul 06 2025 at 12:14 UTC