I was under the impression that tag unions could be merged together into a new union. At least thats how i imagined error handling to work. I'm not that confident in the terminology of roc's concepts yet so here is a code example:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.6/2BfGn4M9uWJNhDVeMghGeXNVDFijMfPsmmVeo6M4QjKX.tar.zst" }
import pf.Stdout
# this works
bar : () -> Try(U32, [Bar(U8), ..])
bar = || {
Err(Bar(5))
}
# This is how definitions look like in Luke's `migrate-zig-compiler` branch for `basic-cli` but i can't get
# this to run
# bar : () -> Try(U32, [Bar(U8)])
# bar = || {
# Err(Bar(5))
# }
foo : () -> Try(U32, [Foo(U8), ..])
foo = || {
a = bar()?
Ok(a + 5)
}
main! = |_args| {
Stdout.line!("Hello, World!")
res = foo()
Stdout.line!("${Str.inspect(res)}")
Ok({})
}
Am i missing something or is that a bug?
Hi @lozzy,
I think this is indeed a bug, can you make a github issue?
Done! https://github.com/roc-lang/roc/issues/9010
Last updated: Feb 20 2026 at 12:27 UTC