There is a lot of noise in this error message, the important part should be focused on; the mismatch between Str and List Str
── 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))
There is a lot of noise in this error message, the important part should be focused on; the mismatch between
Str
andList Str
Code to produce the error: