tixxit on master
Fix Polynomial Gen Merge pull request #758 from Lu… (compare)
case class Multiplicative[A](a: A) extends AnyVal // or opaque type
implicit def multiplicativeMonoidSemiring[A: Semiring]: Monoid[Multiplicative[A]] = …
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.?