Stream: beginners

Topic: Noob questions about some docs


view this post on Zulip Edman Anjos (May 23 2024 at 19:58):

Hello roc, I'm going through the docs, and have a few noob questions:

  1. https://www.roc-lang.org/tutorial#underscore says I can declare a type alias like so RunErr : _. But this gives the error UNDERSCORE NOT ALLOWED HERE. Is this out of date?
  2. https://www.roc-lang.org/examples/Tasks/README.html says "The main task [....] cannot return errors, which is indicated by the *." But in the tutorial we define a main that returns Exit I32 Str, so it can return errors? Or am I missing something?

view this post on Zulip Richard Feldman (May 23 2024 at 21:06):

oops, those are both out of date!

view this post on Zulip Edman Anjos (May 24 2024 at 16:01):

Is there a new way to, as stated in the tutorial, "express that two types are the same without annotating either of them"?

I noticed some type errors using inference will happen at unrelated call sites, when you compose two functions but one of the signatures changed in incompatible ways. I believe the RunErr : _ trick would push the type error down to the function implementations, i.e. where the mismatch actually happens


Last updated: Jul 06 2025 at 12:14 UTC