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?
Checkout the Task and Error Handling Example. I think that should help a bit.
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.
I think once Task
is a builtin, it will be a lot cleaner to add custom error messages for it.
A little off-topic, but is there anything preventing us from adding Task as a builtin right now?
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
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:
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
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