Skip to content

Bad error message on case-match with mismatched return type #5283

@ChrisPenner

Description

@ChrisPenner

If an expression is annotated with a type, but the final expression is a case-match, we get a weird error message. E.g.:

x :  '{IO, Exception} Text
x  = do
  match 1 with
    1 -> 90
    _ -> 128

Will result in the following:

image
Each case of a match / with expression need to have the same type.

Here, one   is:  Text
and another is:  Nat


    4 |     1 -> 90

  from right here:

    1 | x :  '{IO, Exception} Text

This suggests there's a Text branch in the case, but actually that's just the annotated type.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions