tixxit on master
Fix Polynomial Gen Merge pull request #758 from Lu… (compare)
cats
derivations to combine Map (for example, when a Map represents a polynomial)
trait Semiring[A] extends CommutativeMonoid[A] {
def times[A](x: A, y: A): A
def plus[A](x: A, y: A): A = combine(x, y)
def zero[A] = empty[A]
}
trait Rig[A] extends Semiring[A] {
def one[A]: A
}
cats
instances yet, and we haven't taken a position on whether our instances/laws/... should be inherited through the chain cats-kernel/algebra/spire
Monoid[Rational]
in spire.optional
; however, I'm not clear about the default instances in spire, and reluctant to pile more stuff on top of it
Semiring
is defined there
Field
because integral multiplication inverse isn't well defined? Or something to do with complexity of implementing gcd
etc.?
And indeed, integers do not form a field,
Thanks. This makes sense to me now. The set I'm looking at is definitely a field.