Stream: beginners

Topic: How to chain multiple tasks with no results?


view this post on Zulip Ian Liu Rodrigues (Dec 01 2023 at 21:43):

The following roc program fails with The line function expects 1 argument, but it got 3 instead

main =
    Stdout.line "one"
    Stdout.line "two"

How would I fix this?

view this post on Zulip Luke Boswell (Dec 01 2023 at 21:52):

Checkout the Task and Error Handling Example. I think that should help a bit.

view this post on Zulip Sven van Caem (Dec 01 2023 at 22:35):

I wonder if situations like this could get their own custom error message, given how many people try to do this. I know I did this exact thing trying to learn Haskell! I remember the error message GHC gave me was so confusing I ended up putting Haskell down for a good while. I think there's a good opportunity here to smooth out this part of the experience.

view this post on Zulip Brendan Hansknecht (Dec 01 2023 at 22:39):

I think once Task is a builtin, it will be a lot cleaner to add custom error messages for it.

view this post on Zulip Luke Boswell (Dec 01 2023 at 22:54):

A little off-topic, but is there anything preventing us from adding Task as a builtin right now?

view this post on Zulip Brendan Hansknecht (Dec 01 2023 at 22:56):

I think it depends on the effect interpretter stuff. Cause currently task is locked into the effects for each specific platform. Though maybe that is wrong and we can add it or use some compiler tricks to make ti work, not fully sure

view this post on Zulip Richard Feldman (Dec 01 2023 at 22:58):

I think we could do it right now, but I don't love the idea of doing that and then completely redoing the representation once effect interpreters exist :sweat_smile:

view this post on Zulip timotree (Dec 02 2023 at 16:13):

Could this mistake also be detected from the indentation? I assume you don't typically put a function's arguments on the same indentation as the function

view this post on Zulip Brendan Hansknecht (Dec 02 2023 at 16:16):

Hmm, yeah, I think that should work. I mean would probably be a more generic error than needing Task.await chaining, but could be an error around expressions ending or something


Last updated: Jul 06 2025 at 12:14 UTC