I just got this type check error. Unless I'm missing something, those two lines are the exact same:
── TYPE MISMATCH ────────────────────────────────────────────────── Parser.roc ─
Something is off with the body of the makeParser definition:
15│ makeParser : Foo * -> (List [Gt]*, Nat -> [Parsed [Gt], ParseFailed, DeadEnd])
16│ makeParser = \f ->
17│> \items, index ->
18│> when List.get items index is
19│> Ok item -> f item
20│> Err OutOfBounds -> DeadEnd
The body is an anonymous function of type:
List [Gt]*, Nat -> [DeadEnd, ParseFailed, Parsed [Gt]]
But the type annotation on makeParser says it should be:
List [Gt]*, Nat -> [DeadEnd, ParseFailed, Parsed [Gt]]
Foo is:
Foo a : [Gt]a -> [Parsed [Gt], ParseFailed, DeadEnd]
yeah, this can happen when the type checker gets confused. This is a bug
there are some secret variables that we don't show to users, but they make the two types different
Gotcha. Ya just removing the type annotation seems to have fixed it, just wanted to make sure it was a known issue :thumbs_up:
can you make a permalink to a commit that reproduces it real quick?
would be helpful for fixing it later!
Sure! Here you go!
https://github.com/Billzabob/roc-lox/tree/6b7487a75cdaca08f9c8e5aa4c7500e0deb04b95
awesome, thank you!
Last updated: Jul 05 2025 at 12:14 UTC