I'm not sure if this is a bug. I've read through the tutorial and checked the docs; I'm pretty sure a U64 should be acceptable here where List.get
requires a Nat
. Am I missing something obvious?
── TYPE MISMATCH ──────────────────────────────────────────────────── day4.roc ─
This 2nd argument to get has an unexpected type:
55│ maybeBoard = List.get state.boards boardNumber
^^^^^^^^^^^
This boardNumber value is a:
U64
But get needs its 2nd argument to be:
Nat
Even though a Nat
could be a U64
. it is not guaranteed. They are two distinct types to the roc compiler. On a 32 bit system, Nat
is a U32
for example.
Just need to add Num.toNat
or store the number as a Nat
instead of U64
Thank you. I definitely missed that. :thinking:
Last updated: Jul 06 2025 at 12:14 UTC