Skip to content

Instantly share code, notes, and snippets.

@archaeron
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archaeron/705f5b8ee1db85615d01 to your computer and use it in GitHub Desktop.
Save archaeron/705f5b8ee1db85615d01 to your computer and use it in GitHub Desktop.
Idris 0.9.18 bug?
module Test
a : (String -> Either String String) -> String
a b =
case b of
Left err => err
Right v => v
error-test.idr:6:22:
When elaborating left hand side of Test.case block in a:
Can't unify
Either a b (Type of Left _)
with
String -> Either String String (Expected type)
Specifically:
Can't unify
Either a
with
\uv => String -> uv
@archaeron
Copy link
Author

the error is on line 5 though

@david-christiansen
Copy link

The error is really that what you have on 5 doesn't match what you have on 6 - you're asking for an analysis of a variable with type A, but using patterns that assume it must have type B. IMO, it should feel free to report the error in either or both locations.

OTOH, it should also complain that String -> Either String String isn't a valid type to analyze with case. That would have been more helpful here.

I suppose it's worth a "this error message confused me" report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment