Stream: beginners

Topic: Understanding function annotation error


view this post on Zulip Sajjad Naveed (Sep 19 2024 at 08:24):

Just when I thought I was getting the hang of Tasks, I have run into an issue that I can't wrap my head around.

Any help in understanding this will be highly appreciated.

Here is the issue in its simplified form:

The following function works fine with this annotation and body

run : Task {} _
run =
    Stdout.line! "Say something:"
    input = Stdin.line!
    Stdout.line! "You said: $(input)"

but the following throws an error

run : Task {} _
run =
    Stdout.line! "Say something:"

If I either remove the ! from Stdout.line it works, if I remove the annotation above, it still works but not with both.

I am happy to provide more details if needed but I think I have narrowed it down to the example above. Here's the complete working file

app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }

import pf.Stdout
import pf.Stdin

main =
    run

run : Task {} _
run =
    Stdout.line! "Say something:"
    input = Stdin.line!
    Stdout.line! "You said: $(input)"

view this post on Zulip Brendan Hansknecht (Sep 19 2024 at 12:48):

Sounds like a bug in !

view this post on Zulip Sajjad Naveed (Sep 19 2024 at 13:24):

Thanks for replying @Brendan Hansknecht

I genuinely hope it's a bug, otherwise I feel I will have to stop the library I am trying to write and go back to square 0 and start the tutorial all over again.

view this post on Zulip Sajjad Naveed (Sep 19 2024 at 13:34):

Should I raise the issue on github?

view this post on Zulip Brendan Hansknecht (Sep 19 2024 at 14:09):

Yes please

view this post on Zulip Sajjad Naveed (Sep 19 2024 at 19:45):

Raised here.


Last updated: Jul 05 2025 at 12:14 UTC