Erik Erlandson

Results 200 comments of Erik Erlandson

xref: https://github.com/lampepfl/dotty/issues/11827

Quantity as an opaque type: ```scala trait Addable[V]: def plus(x: V, y: V): V given Addable[Int] with def plus(x: Int, y: Int): Int = x + y trait Second object...

investigate whether we can build up canonical signatures using transparent functions and `Typed` https://github.com/dotty-staging/dotty/blob/d8f1b4f7de4dbef63b16fda14d12a9e718668573/docs/docs/typelevel.md#computing-new-types

Here is a meta-programming implementation of `CanonicalSig`: https://github.com/erikerlandson/poc-coulomb-scala3/blob/cbf290521792974b0f78767495a8caa09fdcc974/coulomb/src/coulomb/infra/meta.scala#L17 This implementation has several advantages: * promotion of general types to "implied" BaseUnit does not require special context-types `ImpliedBU` or `StrictUnitExpr` *...

`CanonicalSig` itself is only used as an intermediate construct for what I'm currently calling `ConvertableUnits`. I now believe that almost none of the types currently defined under `infra` would require...

Rethinking some of the mechanics and UX for `unitops` and conversions. In scala-3, implicit object conversions are governed by the existence of `scala.Conversion` (see: https://dotty.epfl.ch/docs/reference/contextual/conversions.html), and are also enable-able by...

I have always been ambivalent about using `%*, %/, %^` instead of just `*, /, ^` - I did it to prevent collision with other libraries that define those types,...

I think I like this. ```scala scala> (1D.withUnit[Meter * Meter] + 1D.withUnit[Yard * Yard]) val res2: coulomb.quantity.Quantity[Double, coulomb.si.Meter * coulomb.si.Meter] = 1.8361273599999999 scala> (1.withUnit[Meter * Meter] + 1D.withUnit[Yard * Yard])...

I realized that it is actually straightforward to support arbitrary numeric (typelevel) constants in unit type expressions: https://github.com/erikerlandson/poc-coulomb-scala3/blob/main/coulomb/src/coulomb/infra/meta.scala#L71 ```scala scala> 1.0.withUnit[Liter / (100 * Kilo * Meter)].toUnit[Meter ^ 2] val...

My plans for "scala 3 coulomb" are: - there will be no dependency on singleton-ops or shapeless - coulomb core will have no dependency on spire, but I will definitely...