Open rlmark opened 2 years ago
I keep hitting this one. (I suspect I am the common element here), but for context and posterity this happens when you're writing ability handlers, but forget to include a reference to a generic ability in your handler.
unique ability Choice where
choose : {Choice} Boolean
fail : {Choice} a
first.impl : Request {g, Choice} a -> Optional a
first.impl = cases
{pure} -> Some pure
{Choice.fail -> resume} -> None
{Choice.choose -> resume } ->
result = handle resume false with first.impl
match result with
Some a -> Some a
None -> handle resume true with first.impl
first : '{g, Choice} a -> Optional a -- <== this should have a {g}
first request = handle !request with first.impl
It'll give you back a note:
Sorry, you hit an error we didn't make a nice message for yet.
Here is a summary of the Note:
simple cause:
TypeMismatch
context:
Γ
|start1|
|let-rec-marker2|
|𝕩4|
'Inference Ability-61
'User "g"-62
'𝕖5 = 𝕖61, g62
first.impl3 : Request {g, Choice} a ->{𝕖61, g62} Optional a
|a7|
@a8
|g10|
@g11
|a13|
@a14
|g16|
@g17
|c1a3dh9i0e119|
c1a3dh9i0e118 : Request {g17, Choice} a14
'match-output20 = Optional a14
'User "a"-21
'g24 = g17
'𝕖23 = g17
'𝕧22 = a14
Still happens in 0.5.23
The type mismatch error for the attached sample transcript produces a non user-facing extended error message, making it difficult to understand what went wrong.
typeMismatch.md