hs-hourglass
hs-hourglass copied to clipboard
Tweak Show instances to pad with zeros
Nanoseconds is to the right of the decimal, and so needs to be zero padded if represenations like 532s.23456789ns
are to make sense; needs to be 532s.023456789ns
. So pad to a width of nine characters.
Obviously Show instances are just for debugging, but it's nice to be uniform.
While we're at it, zero pad the Hour, Minute, and Second types' Show instances to width two characters.
I'd like to do a similarly padded Show instance for Day, but there's no Day newtype, and presumably you don't want the API break that would be cause because the constructor of Date with dateDay
is exposed :: Int.
that's not what those types are for though. they represent an absolute duration (or better non referential) value of {NanoSeconds,Seconds,Minutes,Hours}: not component of a day value.
For example it's valid to say:
Minutes 500000 -- represent 50000 minutes irrespective of referential
Hours 25 -- represent 25 hours irrespective of referential..
This is somewhat confusing as those type are overloaded in their meaning even in hourglass I think. i.e. they are used as component of a day too
related to #24