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
Students (and many other users like me) often forget to resume from a handler.
We could customise the error message, especially when it's obvious from the type that using resume would fix the type error one gets.
Let's take a look at a small example:
effect get():Intdeffoo() =try { println(do get()) }
with get {
42// ^^// Expected Unit but got Int.
}
We could customise ( 🚲🏠 ) the error to something slightly more specific like:
Expected Unit but got Int.
Did you mean to use `resume: Int => Unit` in the handler in order to resume?
The heuristic is pretty straightforward: an additional hint should fire if in the handler we get "expected τ1 but got τ2" andresume has type τ2 => τ1.
The text was updated successfully, but these errors were encountered:
Students (and many other users like me) often forget to
resume
from a handler.We could customise the error message, especially when it's obvious from the type that using
resume
would fix the type error one gets.Let's take a look at a small example:
We could customise ( 🚲🏠 ) the error to something slightly more specific like:
The heuristic is pretty straightforward: an additional hint should fire if in the handler we get "expected
τ1
but gotτ2
" andresume
has typeτ2 => τ1
.The text was updated successfully, but these errors were encountered: