I have the following code that represents GF2 field:
trait GF2 {
def unary_- = this
def + (that: GF2): GF2
def * (that: GF2): GF2
def / (that: GF2)
You need to implement a version of Numeric
for your trait in order for it to work. See here for the full definition you'll need to create.
object InScope{
implicit object GF2Numeric extends Numeric[GF2]{
//..your implementation here
}
}
The full signature of sum
on a List
is actually:
def sum(implicit num: Numeric[A])
Where by the A
is the type of the List[A]
.