Stream: beginners

Topic: arithmetic operations on opaque types


view this post on Zulip Jonas Schell (Feb 18 2024 at 20:29):

I'm playing around with a package similar to elm-units. I found a few people who had tried something before, and I also found some references to it in a few places around abilites. After reading up on abilites it seems like the right thing to do. I saw some mentions on Arithmetic abilites but not enough to find a solution to my problem.

I want to use arithmetic operations on my opaque types (+, -, /, *). Is there a way to achieve this?

view this post on Zulip Luke Boswell (Feb 18 2024 at 21:04):

There's been a lot of discussion on this previously. https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/customizing.20infix.20operators/near/396484877

view this post on Zulip Luke Boswell (Feb 18 2024 at 21:05):

I think the TLDR is there is no way to customise infix operators. You can implement Eq ability to use ==

view this post on Zulip Jonas Schell (Feb 18 2024 at 22:00):

Thanks Luke, I'm totally fine with not having them. I just wanted to make sure I hadn't missed anything.


Last updated: Jul 06 2025 at 12:14 UTC