
Seth Kurtzberg wrote:
Glynn Clements wrote:
Bayley, Alistair wrote:
You also need to specify, or let the user specify, the order of arithmetic. I.e. adding a day and then a second is different from doing it the other way around.
Only when leap seconds are involved. A month and a day would be a better example.
Duration arithmetic is not commutative? Can you give some examples please, because I'm not able to imagine any.
April 30th + 1 month + 1 day = May 30th + 1 day = May 31st April 30th + 1 day + 1 month = May 1st + 1 month = June 1st
What reason is there to say May 30 + 1 day == May 31st? May 30 + 1 day = June first. So the answer is the same either way, as long as your result for May 30 + 1 day is correct.
oops, got my months mixed up, sorry about that. The fallacy here is that month is a unit. Your example proves that it is not. Whether a day is a unit might be controversial (as noted in the thread, it depends on which assumptions you start from) but a month is definitely never a unit.
!DSPAM:421117b0210897468917868!
------------------------------------------------------------------------
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
!DSPAM:421117b0210897468917868!