I hit this in basically my first line of AoC (no spoilers here). It looks like the compiler is confused about an unassigned Task Ok value in the middle of a function. A simple error message on variable assignment here would help beginners.
[jan@framey bug-repro]$ cat main.roc
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br" }
import pf.File
import pf.Stdout
main =
File.readUtf8! "../input.txt"
Stdout.line! "Hi."
[jan@framey bug-repro]$ roc check
roc: /lib64/libtinfo.so.6: no version information available (required by roc)
── TYPE MISMATCH in main.roc ───────────────────────────────────────────────────
Something is off with the body of this suffixed statement:
7│ File.readUtf8! "../input.txt"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This File.readUtf8 call produces:
Task Str […]
But a suffixed statement is expected to resolve to an empty record:
Task {} […]
────────────────────────────────────────────────────────────────────────────────
1 error and 0 warnings found in 33 ms
[jan@framey bug-repro]$
Putting foo =
before it...
[jan@framey bug-repro]$ cat main.roc
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br" }
import pf.File
import pf.Stdout
main =
foo = File.readUtf8! "../input.txt"
Stdout.line! "Hi."
[jan@framey bug-repro]$ roc check
roc: /lib64/libtinfo.so.6: no version information available (required by roc)
── UNUSED ARGUMENT in main.roc ─────────────────────────────────────────────────
This function doesn't use foo.
7│ foo = File.readUtf8! "../input.txt"
^^^
If you don't need foo, then you can just remove it. However, if you
really do need foo as an argument of this function, prefix it with an
underscore, like this: "_foo". Adding an underscore at the start of a
variable name is a way of saying that the variable is not used.
────────────────────────────────────────────────────────────────────────────────
0 errors and 1 warning found in 28 ms
[jan@framey bug-repro]$
or |>
after it...
[jan@framey bug-repro]$ cat main.roc
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.tar.br" }
import pf.File
import pf.Stdout
main =
File.readUtf8! "../input.txt"
|> Stdout.line!
[jan@framey bug-repro]$ roc check
roc: /lib64/libtinfo.so.6: no version information available (required by roc)
0 errors and 0 warnings found in 34 ms
[jan@framey bug-repro]$
seem to solve it.
Can you file an issue?
Is this an issue that just dies with Task?
Idk, I haven't made a post-Task app yet, and I don't plan to until maybe February
But happy to test what basic-cli@purity-inference does with it!
Brendan Hansknecht said:
Is this an issue that just dies with Task?
Seems likely! The result of this call to File.readUtf8! is ignored:
is exactly what I was hoping to see above (though idk what the other messages are about - I'm probably doing PI wrong)
jan@lenny:~/_roc/bug-repro$ cat main.roc
app [main] { pf: platform "../basic-cli/platform/main.roc" }
import pf.File
import pf.Stdout
main! = \{} ->
File.readUtf8! "../input.txt"
Stdout.line! "Hi."
jan@lenny:~/_roc/bug-repro$ roc dev
── UNRECOGNIZED NAME in ../basic-cli/platform/main.roc ─────────────────────────
The #UserApp module does not expose anything by the name 1.
── UNRECOGNIZED NAME in ../basic-cli/platform/main.roc ─────────────────────────
The #UserApp module does not expose anything by the name 1.
── IGNORED RESULT in main.roc ──────────────────────────────────────────────────
The result of this call to File.readUtf8! is ignored:
7│ File.readUtf8! "../input.txt"
^^^^^^^^^^^^^^
Standalone statements are required to produce an empty record, but the
type of this one is:
Result Str [
FileReadErr Path.Path InternalFile.ReadErr,
FileReadUtf8Err Path.Path [BadUtf8 Utf8ByteProblem U64],
]
If you still want to ignore it, assign it to _, like this:
_ = File.delete! "data.json"
── MISSING DEFINITION in main.roc ──────────────────────────────────────────────
main is listed as exposed, but it isn't defined in this module.
You can fix this by adding a definition for main, or by removing it
from exposes.
────────────────────────────────────────────────────────────────────────────────
4 errors and 1 warning found in 44 ms
.
You can run the program anyway with roc run
jan@lenny:~/_roc/bug-repro$
JanCVanB said:
Idk, I haven't made a post-Task app yet, and I don't plan to until maybe February
this reads sassy to me now - sorry, didn't mean to bring negativity
JanCVanB said:
JanCVanB said:
Idk, I haven't made a post-Task app yet, and I don't plan to until maybe February
this reads sassy to me now - sorry, didn't mean to bring negativity
You're good fam
Last updated: Jul 06 2025 at 12:14 UTC