From 9c79982d59d4ae6b20e52ab595ab6f6e3e200477 Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Tue, 14 May 2024 08:50:50 +0200 Subject: [PATCH] Use stopgap approaching `modularity` --- src/core/quantify.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/quantify.scala b/src/core/quantify.scala index 8c96797..b0ff42a 100644 --- a/src/core/quantify.scala +++ b/src/core/quantify.scala @@ -260,10 +260,13 @@ object Quantitative extends Quantitative2: erased given underlying[UnitsType <: Measure]: Underlying[Quantity[UnitsType], Double] = ### erased given [UnitsType <: Measure]: CanEqual[Quantity[UnitsType], Quantity[UnitsType]] = ### - given genericDuration: GenericDuration[Quantity[Seconds[1]]] = - quantity => (quantity*1000.0).toLong + given genericDuration: GenericDuration with + type Self = Quantity[Seconds[1]] + def milliseconds(quantity: Quantity[Seconds[1]]): Long = (quantity*1000.0).toLong - given specificDuration: SpecificDuration[Quantity[Seconds[1]]] = long => Quantity(long/1000.0) + given specificDuration: SpecificDuration with + type Self = Quantity[Seconds[1]] + def duration(long: Long): Quantity[Seconds[1]] = Quantity(long/1000.0) transparent inline given add[LeftType <: Measure, RightType <: Measure] : AddOperator[Quantity[LeftType], Quantity[RightType]] =