You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
roc nightly pre-release, built from commit 0bf249afcbb on Mon Dec 23 09:14:40 UTC 2024
When running roc 3.roc where 3.roc is the following file:
app [main] {
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br",
aoc: "https://github.com/lukewilliamboswell/aoc-template/releases/download/0.2.0/tlS1ZkwSKSB87_3poSOXcwHyySe0WxWOWQbPmp7rxBw.tar.br",
}
import pf.Stdinimport pf.Stdoutimport pf.Utcimport aoc.AoC {
stdin: Stdin.readToEnd,
stdout: Stdout.write,
time: \{} -> Utc.now {} |>Task.mapUtc.toMillisSinceEpoch,
}
main =
AoC.solve {
year: 2024,
day: 3,
title: "Historian Hysteria",
part1,
part2,
}
unwrap : Result ok err, Str -> ok
unwrap = \result, crashMsg ->
when result isOk value -> value
Err_ -> crash crashMsg
clear = \state -> { state & mode: Nothing, first_operand: [], second_operand: [] }
list_to_num : ListU8 -> I32list_to_num = \list ->
list |>Str.fromUtf8|> unwrap "couldn't convert from UTF8"|>Str.toI32|> unwrap "couldn't convert to int"parse : Str, Bool -> ResultStr_parse = \input, do_and_dont ->
Str.walkUtf8
input
{
enabled: Bool.true,
mode: Nothing,
first_operand: [],
second_operand: [],
result: 0,
}
\state, char ->
{ enabled, mode, first_operand, second_operand, result } = state
when mode isNothing ->
when char is'm'if enabled -> { state & mode: M }
'd'if do_and_dont -> { state & mode: D }
_ -> clear state
M ->
when char is'u' -> { state & mode: U }
_ -> clear state
U ->
when char is'l' -> { state & mode: L }
_ -> clear state
L ->
when char is'(' -> { state & mode: OpenParen }
_ -> clear state
OpenParen ->
when char is'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0' ->
{ state &
mode: FirstOperand,
first_operand: List.append first_operand char,
}
_ -> clear state
FirstOperand ->
when char is'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0' ->
{ state &
first_operand: List.append first_operand char,
}
',' -> { state & mode: Comma }
_ -> clear state
Comma ->
when char is'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0' ->
{ state &
mode: SecondOperand,
second_operand: List.append second_operand char,
}
_ -> clear state
SecondOperand ->
when char is'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0' ->
{ state &
second_operand: List.append second_operand char,
}
')' ->
{ state &
mode: Nothing,
first_operand: [],
second_operand: [],
result: result + ((list_to_num first_operand) * (list_to_num second_operand)),
}
_ -> clear state
D ->
when char is'o' -> { state & mode: O }
_ -> clear state
O ->
when char is'(' -> { state & mode: DoOpenParen }
'n' -> { state & mode: N }
_ -> clear state
DoOpenParen ->
when char is')' -> { state & mode: Nothing, enabled: Bool.true, first_operand: [], second_operand: [] }
_ -> clear state
N ->
when char is'\'' -> { state & mode: Apostrophe }
_ -> clear state
Apostrophe ->
when char is't' -> { state & mode: T }
_ -> clear state
T ->
when char is'(' -> { state & mode: DontOpenParen }
_ -> clear state
DontOpenParen ->
when char is')' -> { state & enabled: Bool.false, first_operand: [], second_operand: [], mode: Nothing }
_ -> clear state
|>.result|>Num.toStr|>Ok## Implement your part1 and part2 solutions herepart1 : Str -> ResultStr_part1 = \input -> parse input Bool.falsepart2 : Str -> ResultStr_part2 = \input -> parse input Bool.true
I immediately get the following error:
thread '<unnamed>' panicked at crates/compiler/mono/src/ir.rs:6246:56:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
roc --version
:When running
roc 3.roc
where3.roc
is the following file:I immediately get the following error:
and then it hangs and I have to CTRL+C out.
roc/crates/compiler/mono/src/ir.rs
Line 6246 in 57cab7f
It sounds like there are many known bugs with lambda sets, but just wanted to report this in case its helpful 😄
The text was updated successfully, but these errors were encountered: