We just landed opaque types in the language and need help migrating uses of private tags to these new opaque types! If you'd like to help out, please see https://github.com/rtfeldman/roc/issues/2584 and feel free to follow up in this thread!
Hi,
Happy to give a hand
Happy to work on this as well
@Carlo Munguia about to go to bed and then I have work tomorrow... Won't be able to make any progress before tomorrow evening (18 UTC).
Feel free to take lead
I might be able to look into some aspects of it later this week / next week. Very busy at them moment and not yet confident at all in the codebase.
Will check in then and see if there’s still stuff to do on this.
Hey, I’d be happy to help with this. Which of the subtasks do you think could be a good start for a first dig into the codebase @Ayaz Hafiz?
They need to be done roughly in order, so the first one. The first will also show you roughly how the code base is organized.
Currently looking at ^^
But I am having issues finding private tags
When I search the project for @
I see a lot of results
When I look for private
I see a few different constucts
Overall, I am just unsure where to start
Anyone would have a clue
Possibly the name of a test to fix
Ok, one test fixed, N to go :)
Also, I see "opaque type" and "opaque reference"
What would the difference be?
Can you give some more context about where you saw "opaque reference"?
An error message, will grab the test name
qualified_private_tag
When I change the @Foo.Bar to $Foo.Bar
The SYNTAX PROBLEM
becomes "Looks like an opaque reference is treated like a module name."
OK so it means a reference to an opaque type. As in, referring to it by name.
You asked about the difference. The opaque type is the type itself. The "opaque reference" is a particular place in the code where it is used.
I have updated all tests didn't require any additional changes
Those that remain, grep @[A-Za-z]
, are comments or throw errors that don't seem to be right
Could someone nudge me in the right direction?
https://github.com/rtfeldman/roc/pull/2614
I'll fix the error in constrain::test_constrain::constrain_private_tag
.
Should TagName
in compiler/module/src/ident.rs
be updated as well? It still has a Private(Symbol)
variant.
For opaque types, why doesn't this work?
Age := U64
test : {} -> Age
test = \{} -> @Age 42
The returned error is:
Something is off with the body of the test definition:
17│ test : {} -> Age
18│ test = \{} -> @Age 42
^^^^^^^
This @Age private tag application has the type:
[ @Age (Num a) ]b
But the type annotation on test says it should be:
Age
Is it a bug? I feel like the types should check here.
Because we haven’t flipped them to use @ yet since we still have private tags :)
$Age instead of @Age should work
Thanks
for sure. let us know if you do see any bugs. i don’t think there should be many but i’m sure i missed something
My apologies on super delay on this work - my windows laptop died an unhappy death but has since been replaced - I can now resume any Roc work
Last updated: Jul 06 2025 at 12:14 UTC