3 ms·
Haskell has a couple libraries that would be great here; either the excellent time library, or the very powerful dimensional library with full statically typed
by wyager 5y ago
Haskell has a couple libraries that would be great here; either the excellent time library, or the very powerful dimensional library with full statically typed SI units. Of course for something as core as threadDelay, a newtype is more appropriate as you say.
- throwaway81523 5y agoAnother approach (used somewhat by Python, at least for time units) is use SI units or some other standard or convention, and be willing to use floating point numbers for measurements. That was considered bloat in the old days, but reasonable general purpose computers these days almost always have FPU hardware.