So my PR #67 makes the Num instance consistent in the following way:
fromInteger interprets the integral as nanoseconds
the unit element of multiplication (*) is "one nanosecond" (TimeSpec 0 1)
TimeSpec is an instance of Integral
IMO this is the simpler and more useful approach. But there is another Num instance defined in the style of Fixed in the following way:
fromInteger interprets the integral as seconds
the unit element of multiplication (*) is "one second" (TimeSpec 1 0)
It is an instance of RealFrac
I wrote this as a wrapper newtype Seconds here in this PR. The behavior is chosen to be similar to Float/Double, so #49 should be solved by using this newtype instead of TimeSpec.
The name "Seconds" is inspired by extra, I don't know if it's really a good name for it.
So my PR #67 makes the Num instance consistent in the following way:
IMO this is the simpler and more useful approach. But there is another Num instance defined in the style of Fixed in the following way:
I wrote this as a wrapper newtype
Seconds
here in this PR. The behavior is chosen to be similar to Float/Double, so #49 should be solved by using this newtype instead of TimeSpec.The name "Seconds" is inspired by extra, I don't know if it's really a good name for it.