Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make bitwise operators a typeclass #55

Open
mikesol opened this issue Jan 3, 2023 · 2 comments
Open

Make bitwise operators a typeclass #55

mikesol opened this issue Jan 3, 2023 · 2 comments

Comments

@mikesol
Copy link

mikesol commented Jan 3, 2023

The WebGPU API uses more specialized flavors of Int like unsigned long and unsinged long long. It's practical to newtype these over Int, but then, when doing bitmasks, one can't get the underlying Int without exposing the newtype constructor. If Bitwise operators like and, and or were all in a typeclass, this would allow us to derive newtype and would allow other specializations.

@JordanMartinez
Copy link
Contributor

That is one approach. Another is that the WebGPU library could define its own type class for doing this to make it easier on the library.

The reason why I'm suggesting this is that I'm not sure where else this need arises other than in that library. So, is it really worth introducing the type class here? Or does it suffice to put it there?

Also, those operators have special compiler support, so just adding a type class may require updates to the compiler (I don't know for sure, but it's something that would need to be checked).

@flip111
Copy link

flip111 commented Oct 8, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants