-
Notifications
You must be signed in to change notification settings - Fork 90
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
Split Semiring into Semiring and Dioid #305
Comments
See also https://encyclopediaofmath.org/wiki/Idempotent_semi-ring, which is where they redirect from dioid. |
Idempotent semi-ring is the wrong concept. We don't want something that requires idempotence. |
@MonoidMusician, in general, does the idea seem interesting, or do you see any pitfalls in there? |
I'd want to see a use-case for the extra generality before making a breaking change. I personally don't have use for it. |
The thought came up when I was working on a shader compiler for WebGPU. WebGPU shaders have tons of overloaded primitive operations, for example multiplying a vector by a float. That expressivity is really nice when writing shaders and is industry-standard stuff: it gets unergonomic if you can't do that because of how often you're doing vector and matrix transforms. Obviously, class Bisemiring a b c | a b -> c where
add :: a -> b -> c
mul :: a -> b -> c
instance Bisemiring Number (Vec3 Number) (Vec3 Number) where...
instance Bisemiring (Vec3 Number) Number (Vec3 Number) where...
instance Bisemiring (Vec3 Number) (Vec3 Number) (Vec3 Number) where...
instance Bisemiring Number Number Number where... Without It's a minor nit, but hopefully you can see the line of thinking that got me there. |
From @mikesol in Discord:
The text was updated successfully, but these errors were encountered: