Stream: beginners

Topic: First feeling and feedback.


view this post on Zulip removewingman (Aug 28 2026 at 22:22):

Just want to give feedback, ask some questions and say thanks. I have ocaml and zig background and work just with basic editor with syntax highlighting and no lsp. Which means I work much with the compiler.

awesome

questions/feature wishes

possibility to document each union value

    ##  Allowed system calls.
    SystemOperation : [
        ## gives accesss to Stdin: (this does not show in generated docs)
        StdinStdoutStderrAndBasicFunctionality,
        ReadFromFilesystem,

github action setup-roc usage with codeberg/forgejo (works if one supplies gh token)

https://codeberg.org/removewingman/restricted-roc/actions/runs/3/jobs/0/attempt/1

Installing Roc version: nightly-new-compiler
Detected OS: Linux
Detected architecture: x86_64
curl: (22) The requested URL returned error: 401

I also tried earlier with specific commit. Something in the action is not publicly accessible.

hardware support (maybe after 0.1.0?)

as described in #beginners > Roc on Alpine Linux , maybe something like this would be nice:

Instead of default and v1 have a build option compatible and performant and one can choose when building rock which to use.

os support (mayber after 0.1.0?)

I know roc is highly experimental, but I like the it and the state it is in, thanks.

view this post on Zulip Luke Boswell (Aug 28 2026 at 23:53):

On the support for OpenBSD front, I imagine we just need users and contributors willing to support it, or some kind of sponsorship to put resources into it I guess. Do you know what the gaps are currently?

I tried to setup a spare machine I have with OpenBSD and didn't quite get zig 0.16.0 setup before getting distracted on other things. :sweat_smile:

view this post on Zulip Aurélien Geron (Aug 28 2026 at 23:54):

Great feedback, @removewingman!

Regarding tagged unions, the difference between a closed union like [A, B] and an open union like [A, B, ..] is that the open union is extensible, meaning it can be assigned to a superset union. For example, the following code works fine:

foo : [A, B, ..]
foo = A

bar : [A, B, C, D]
bar = foo

But if you replace foo : [A, B, ..] with foo : [A, B] in the code above, then the compiler will give a type mismatch error.

The confusing thing (to me) is that you can actually do exhaustive matches with both open and closed unions. For example, the following works fine, even though the .. syntax makes it look like other tags are possible, so the match doesn't look exhaustive, even though it actually is:

f : [A, B, ..] -> Str
f = |x| {
    match x {
        A => "A"
        B => "B"
    }
}

I think I might prefer a syntax like [A, B]* for open unions (or some other syntax with a symbol outside of [A, B]), as it would be clearer that A and B are the only possible tags, but the * would indicate that it can be assigned to a superset union.

Also, the following code doesn't work at the moment, there's a type mismatch on the last line because [A, B] cannot be converted to [A, B, C]:

f : U64 -> Try(U64, [A, B])
f = |x| if x < 10 { Ok(x) } else if x < 100 { Err(A) } else { Err(B) }

g : U64 -> Try(U64, [A, B, C])
g = |x| if x > 1000 { Err(C) } else { f(x) }

To work around this issue, you can either make f return an open union (f : U64 -> Try(U64, [A, B, ..]), which is usually the simplest solution, or you can map the [A, B] tags returned by f to [A, B, C] tags using map_err, like this:

f : U64 -> Try(U64, [A, B])
f = |x| if x < 10 { Ok(x) } else if x < 100 { Err(A) } else { Err(B) }

g : U64 -> Try(U64, [A, B, C])
g = |x| if x > 1000 { Err(C) } else {
    f(x).map_err(
        |err| match err {
            A => A
            B => B
        }
    )
}

This ain't great, but luckily it will be fixed soon: there's a PR to allow a closed union in an output position to be extended when needed, so the first implementation of g will work just fine.

view this post on Zulip Luke Boswell (Aug 28 2026 at 23:57):

might prefer a syntax like [A, B]* for open unions.

This was the syntax before we changed it to .. ] because people found it more confusing.

view this post on Zulip Aurélien Geron (Aug 29 2026 at 00:04):

Yeah, perhaps [A, B]* isn't clear enough. But I really don't like [A, B, ..], it reads like "A, B, or anything else", which is really _not_ what it means.

view this post on Zulip Luke Boswell (Aug 29 2026 at 00:07):

This was the tracking issue from around that time https://github.com/roc-lang/roc/issues/7091

view this post on Zulip Aurélien Geron (Aug 29 2026 at 00:13):

Could we perhaps use .. outside of [A, B]? For example:

f : U64 -> Try(U64, [A, B]..)

I personally find this much less confusing: it says "the possible values are A and B, but we could extend this".

view this post on Zulip Luke Boswell (Aug 29 2026 at 00:51):

Maybe we move this to an ideas thread?

view this post on Zulip removewingman (Aug 29 2026 at 11:21):

Thanks for the explanation around tagged unions, I think I understand now, still a little bit complex.
I hope this https://github.com/roc-lang/roc/pull/10434 lands, would hide the complexity and make it simpler.

Regarding OpenBSD, it is more like a longterm wish. I would be probably the only user, for now. OpenBSD is Tier 2 Target Support in zig, so one can just download the binary and it works: https://ziglang.org/download/0.16.0/release-notes.html#Support-Table There is also a port: https://codeberg.org/OpenBSD/ports/src/branch/master/lang/zig/Makefile

view this post on Zulip Jared Ramirez (Aug 29 2026 at 15:16):

Aurélien Geron said:

The confusing thing (to me) is that you can actually do exhaustive matches with both open and closed unions. For example, the following works fine, even though the .. syntax makes it look like other tags are possible, so the match doesn't look exhaustive, even though it actually is:

f : [A, B, ..] -> Str
f = |x| {
    match x {
        A => "A"
        B => "B"
    }
}

this is surprising to me! i think this match should require a _ => … base case. can you open an issue?

view this post on Zulip removewingman (Aug 29 2026 at 15:54):

I does not actually work, the following example, throws an error when compiling with the hint that the _ is missing as pattern:

f : [A, B, ..] -> Str
f = |x| {
    match x {
        A => "A"
        B => "B"
    }
}

expect f(A) == "A"

view this post on Zulip Aurélien Geron (Aug 29 2026 at 19:17):

Oh interesting, I tested this code in the REPL:

» f : [A, B, ..] -> Str
  f = |x| {
      match x {
          A => "A"
          B => "B"
      }
  }
assigned `f`
» f(A)
"A"
» f(B)
"B"
» f(C)
This Roc code crashed with: "hit a runtime error"

I've opened issue #10985.

view this post on Zulip Aurélien Geron (Aug 29 2026 at 19:26):

I guess the [A, B, ..] syntax is fine, then, sorry for the noise.


Last updated: Sep 03 2026 at 15:16 UTC