squants icon indicating copy to clipboard operation
squants copied to clipboard

Refined Types + Measures

Open odavy37 opened this issue 7 months ago • 0 comments

Dear Sir / Madam,

I'd like to create a newtype + Squant Type + Refined Type

For example : the cost (capex) of a power plant is a Money + Positive

opaque type PowerPlantCapex = Money Refined Positive
object PowerPlantCapex extends RefinedTypeOps[PowerPlantCapex, Money]

How ca I do : there is an error

No given instance of type eu.timepit.refined.api.RefinedType.AuxT[
org.odavy.powertycoon.domain.entities.PowerPlantCapex, squants.market.Money] was found for parameter rt of constructor RefinedTypeOps in class RefinedTypeOps.
I found:

eu.timepit.refined.api.RefinedType.instance[eu.timepit.refined.api.Refined,
squants.market.Money, eu.timepit.refined.numeric.Greater[(0 : Int)]](
eu.timepit.refined.api.RefType.refinedRefType,
eu.timepit.refined.numeric.Greater.greaterValidate[squants.market.Money,
(0 : Int)](eu.timepit.refined.internal.WitnessAs.singletonWitnessAs[B, A],
???)
)

But given instance singletonWitnessAs in object WitnessAs does not match type eu.timepit.refined.internal.WitnessAs[(0 : Int), squants.market.Money].


odavy37 avatar May 18 '25 16:05 odavy37