Type mismatches with Result should not show `Ok` and `Err` on one side and `Result` on the other
Anton-4 opened this issue · comments
This should show Result
on both sides:
── TYPE MISMATCH in examples/helloWorld.roc ────────────────────────────────────
Something is off with the then branch of this if expression:
6│ myResult: U64 -> Result Str [TooSmall]
7│ myResult = \x ->
8│ if x > 5 then
9│ Ok ["large enough!"]
^^^^^^^^^^^^^^^^^^^^
This Ok tag application has the type:
[
Err [TooSmall],
Ok (List Str),
]
But the type annotation on myResult says it should be:
Result Str [TooSmall]
────────────────────────────────────────────────────────────────────────────────
Code to produce the error:
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.12.0/Lb8EgiejTUzbggO2HVVuPJFkwvvsfW6LojkLR20kTVE.tar.br" }
import pf.Stdout
import pf.Task
myResult: U64 -> Result Str [TooSmall]
myResult = \x ->
if x > 5 then
Ok ["large enough!"]
else
Err TooSmall
main =
Stdout.line! (Inspect.toStr (myResult 6))