Modeling with opaque types in Scala 3

I like physics. The reason behind it is that physics has a beautiful and consistent type system. Let’s start with very simple scalar model, that is used in Newton mechanics. What we need here are several types like Time, Acceleration, Velocity, Displacement for kinematics. If we also deal with dynamic, we need Mass, Force, Momentum and Energy. We are also introducing Constant, that is just a number and can be used solely as multiplier (or divider, but not implemented). ...

February 6, 2021 · 5 min · 953 words · Me