Skip to content

DoubleU[/[O,I]#Mul[I]] not being treated as Double[O] #7

@gbeaty

Description

@gbeaty
def linear[I <: MUnit,O <: MUnit](n: String, offset: DoubleU[O], coef: DoubleU[O / I]) =
  Sensor.Invertible[I,O](n, i => offset + coef * i, o => (o - offset) / coef)

Produces:

[error]  overloaded method value + with alternatives:
[error]   (i: DoubleU[O])DoubleU[O] <and>
[error]   (i: IntU[O])DoubleU[O]
[error]  cannot be applied to (DoubleU[/[O,I]#Mul[I]])
[error]       Sensor.Invertible[I,O](n, i => offset + coef * i, o => (o - offset) / coef)
[error]                                             ^

Is that sort of type-arithmetic even possible in Scala? I'm guessing not, but had to ask.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions