3 ms·
Some languages, like Haskell, let you extend the numerical types to whatever representation works well for your causes. A few years ago I wrote a library for em
by haasn 10y ago
Some languages, like Haskell, let you extend the numerical types to whatever representation works well for your causes. A few years ago I wrote a library for embedding units of measure into every figure (at the type level), including e.g. auto-converting between units.
It's somewhat bitrotten but it may still be interesting if you're into this sort of thing: See [1] for an example of how it looks in practice.
[1] https://github.com/haasn/units/blob/master/tests/Tests.hs https://github.com/haasn/units/blob/master/tests/Tests.hs