Stream: contributing

Topic: Opaque types


view this post on Zulip Ayaz Hafiz (Feb 27 2022 at 21:01):

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!

view this post on Zulip Philippe (Feb 27 2022 at 21:16):

Hi,

Happy to give a hand

view this post on Zulip Carlo Munguia (Feb 27 2022 at 21:19):

Happy to work on this as well

view this post on Zulip Philippe (Feb 27 2022 at 21:28):

@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

view this post on Zulip Bastian Beuttel (Feb 28 2022 at 05:33):

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.

view this post on Zulip Loric Brevet (Feb 28 2022 at 09:13):

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?

view this post on Zulip Ayaz Hafiz (Feb 28 2022 at 14:07):

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.

view this post on Zulip Philippe (Feb 28 2022 at 19:10):

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

view this post on Zulip Philippe (Feb 28 2022 at 19:16):

Ok, one test fixed, N to go :)

view this post on Zulip Philippe (Feb 28 2022 at 19:26):

Also, I see "opaque type" and "opaque reference"
What would the difference be?

view this post on Zulip Brian Carroll (Feb 28 2022 at 19:34):

Can you give some more context about where you saw "opaque reference"?

view this post on Zulip Philippe (Feb 28 2022 at 19:43):

An error message, will grab the test name

view this post on Zulip Philippe (Feb 28 2022 at 19:45):

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."

view this post on Zulip Brian Carroll (Feb 28 2022 at 19:52):

OK so it means a reference to an opaque type. As in, referring to it by name.

view this post on Zulip Brian Carroll (Feb 28 2022 at 19:55):

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.

view this post on Zulip Philippe (Feb 28 2022 at 22:44):

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

view this post on Zulip Anton (Mar 01 2022 at 07:40):

I'll fix the error in constrain::test_constrain::constrain_private_tag.

view this post on Zulip Anton (Mar 01 2022 at 10:00):

Should TagName in compiler/module/src/ident.rs be updated as well? It still has a Private(Symbol) variant.

view this post on Zulip Brendan Hansknecht (Mar 08 2022 at 19:00):

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.

view this post on Zulip Ayaz Hafiz (Mar 08 2022 at 19:10):

Because we haven’t flipped them to use @ yet since we still have private tags :)

view this post on Zulip Ayaz Hafiz (Mar 08 2022 at 19:10):

$Age instead of @Age should work

view this post on Zulip Brendan Hansknecht (Mar 08 2022 at 19:12):

Thanks

view this post on Zulip Ayaz Hafiz (Mar 08 2022 at 19:14):

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

view this post on Zulip Carlo Munguia (Apr 09 2022 at 12:47):

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