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
I've tried to implement a state monad to solve one of the advent of code tasks. Below is a very pared-down version that doesn't make sense in itself, but still reproduces the compiler crash.
I haven't been able to simplify it further while reproducing the crash. This crash happens on macOS-Intel.
The crash is the following with both roc_nightly-macos_x86_64-2024-12-18-1285a24 and roc_nightly-macos_x86_64-2024-12-28-2e2be45.
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
no lambda set found for (`#UserApp.IdentId(40)`, [
InLayout(
94,
),
InLayout(
118,
),
]): LambdaSet {
set: [
( Test.40, [InLayout(94), InLayout(109)]),
],
args: [
InLayout(U64),
],
ret: InLayout(
83,
),
representation: InLayout(
100,
),
full_layout: InLayout(
105,
),
}
Location: crates/compiler/mono/src/layout.rs:1590:17
Here is the code:
app [main] {
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br",
}
import pf.Stdout
main =
step 0 |> eval 0 |> Inspect.toStr |> Stdout.line
step : U64 -> Checksum
step = \i ->
if
0 == i
then
checksum i
else
checksum i
|> bind \s0 ->
step (i - 1)
|> map \s1 -> s0 + s1
Checksum : State U64 U64
checksum : U64 -> Checksum
checksum = \len ->
get
|> bind \pos ->
put (pos + len)
|> map \_ -> len * (2 * pos + len - 1) // 2
State s a := s -> (a, s)
run : State s a, s -> (a, s)
run = \@State s, t -> s t
eval : State s a, s -> a
eval = \s, t -> (run s t).0
put : s -> State s {}
put = \s -> @State \_ -> ({}, s)
get : State s s
get = @State \s -> (s, s)
map : State s a, (a -> b) -> State s b
map = \s, f -> @State \s0 ->
(x, s1) = run s s0
(f x, s1)
bind : State s a, (a -> State s b) -> State s b
bind = \s, f -> @State \s0 ->
(x, s1) = run s s0
run (f x) s1
The text was updated successfully, but these errors were encountered:
Hi,
I've tried to implement a state monad to solve one of the advent of code tasks. Below is a very pared-down version that doesn't make sense in itself, but still reproduces the compiler crash.
I haven't been able to simplify it further while reproducing the crash. This crash happens on
macOS-Intel
.The crash is the following with both
roc_nightly-macos_x86_64-2024-12-18-1285a24
androc_nightly-macos_x86_64-2024-12-28-2e2be45
.Here is the code:
The text was updated successfully, but these errors were encountered: