Stream: beginners

Topic: ✔ has keyword


view this post on Zulip Gabriel Pickl (Oct 16 2022 at 12:05):

It seems in one of the recent nightlies, has Eq has become a way to describe that something is comparable. I haven't found any documentation on this so far. Is there a place I can read up on what features this entails, or should i be patient for a more formal release here? (I'm interested in whether I can implement Eq for a type, for example)

view this post on Zulip Michał Łępicki (Oct 16 2022 at 12:09):

I think this is the WIP Abilities feature

view this post on Zulip Gabriel Pickl (Oct 16 2022 at 12:19):

thanks ^_^

view this post on Zulip Ayaz Hafiz (Oct 16 2022 at 13:10):

some of that document may be out of date with the current design of abilities. But yes you can implement Eq for a custom type, see this test for an example! https://github.com/roc-lang/roc/blob/d6885bde232f85708d6accd39488ddb455288e44/crates/compiler/test_gen/src/gen_abilities.rs#L1622

view this post on Zulip Gabriel Pickl (Oct 16 2022 at 14:41):

That's a pretty elegant way of doing that :)

view this post on Zulip Notification Bot (Oct 16 2022 at 14:41):

Gabriel Pickl has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC