Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
erikerlandson opened this issue Mar 8, 2020 · 1 comment
Closed

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

erikerlandson opened this issue Mar 8, 2020 · 1 comment

Comments

@erikerlandson
Copy link
Owner

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
Copy link
Owner Author

Although this is interesting, my attempts so far to make it work have failed, and it would be a major increase in implementation complexity, and also increase difficulty to reason about coulom's behavior, so I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant