Comments (4)
cc @non
We implemented this stuff a very long time ago and may well have made a few mistakes in the encoding.
How should this have been encoded? It seems that extending GCDRing
was a mistake in your view, but we don't have GCDRig
do we? So I wonder if the hierarchy has greater issues in this regard.
What do you propose as our best course of action?
from cats.
I think the "right" (ideal) representation would extend a EuclidianRig
from Rig
. AFAICT Euclidian doesn't need negation in its sematics or laws, and there could be a valid instance for natural numbers without subtraction.
I like the way NumHask models algebra, although the names are different. NumHask's Integral ~ Cats EuclidianRing
and it extends Distributive, which ~ Cats Rig
.
Possibly the "right" (pragmatic) solution is to mark this issue as Won't fix and simply leave it as a signpost for the next generation of library writers. Its likely a breaking change and I'd guess very few people care.
I don't have strong knowledge or views on why GCDRing is separated from EuclidianRing. Is there any known trait that extends GCDRing but not EuclidianRing?
from cats.
I wouldn't be surprised if no one has ever used this code. The breakage cross section may be very low here.
That said, an abstraction that is never used it also tautologically not useful. I imagine that you can add a trait to your own code just as well if you intend to use it.
If we had confidence of the improvement adding a new trait costs very little.
from cats.
Well, I think a solution could be to
- new trait
GCDRig
extendingRig
- new trait
EuclidianRig
extendingGCDRig
. - existing
GCDRing
would now extendRing
andGCDRig
- existing
EuclidianRing
would now extendGCDRing
andEuclidianRig
Practically this would allow natural numbers to be supported since they can provide a EuclidianRig[Nat]
from cats.
Related Issues (20)
- algebra-core/src HOT 1
- Option size method implicitly selected from UnorderedFoldable HOT 2
- IndexedStateT has superfluous parts HOT 4
- .splitWhen
- Difference in the Applicative inferred for Seq[Seq[?]]#sequence between Scala 2 and 3
- Inconsistent behaviour when using Eval as Applicative
- `Tuple1SemigroupalOps` methods have different names from other `TupleNSemigroupalOps` classes HOT 3
- Instances for Currency HOT 7
- EitherT[Option, ?, ?]] can't be used as a bifunctor HOT 5
- OutOfMemoryError when IO.uncancelable is used in recursive function HOT 1
- ambiguous implicit resolution of `Show.ContravariantShow[immutable.SortedMap[K, V]]` HOT 1
- Should Monad extend Defer? HOT 11
- Support Scala Native 0.5 HOT 3
- Adding an alternative version of the method whenA with a different signature
- `Eval` thread safety HOT 4
- Optimize `distinct`/`distinctBy` implementations for non-empty collections
- [PROPOSAL] Aliases for methods `traverse_` and `sequence_` HOT 7
- Any reason `intercalate` isn't exposed directly on the `Semigroup` companion object? HOT 3
- (very breaking) change in Future instances? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cats.