coulomb icon indicating copy to clipboard operation
coulomb copied to clipboard

Should the unit type `U` in Quantity[N, U] be covariant?

Open erikerlandson opened this issue 4 years ago • 0 comments

trait Fruit
trait Apple extends Fruit
trait Pear extends Fruit

val q1 = 1.withUnit[Apple] + 1.withUnit[Pear]  // is q1 Quantity[Int, Fruit] ?

def f1(f: Quantity[Int, Fruit]) = { ... }

f1(1.withUnit[Apple])
f1(1.withUnit[Pear])

would likely depend on #22

erikerlandson avatar Mar 08 '20 19:03 erikerlandson