Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't 'ZonedTime' have an 'Eq' or 'Ord' instance

Tags:

time

haskell

In the time package we have the type ZonedTime which represents a LocalTime a product of localDay :: Day and localTimeOfDay :: TimeOfDay. LocalTime has instances for Eq and Ord, but ZonedTime does not. It seems to me that ZonedTimes ought to be compared from an absolute reference frame still—at least as much as LocalTimes could be.

Why doesn't ZonedTime have Eq and Ord instances as well?

It's worth noting that the time rewrite thyme actually does have Eq and Ord instances, though I'd prefer not to use non-standard time types unless needed.

like image 360
J. Abrahamson Avatar asked Mar 15 '13 18:03

J. Abrahamson


1 Answers

I can only speculate that the reason is that it is not entirely clear how times that have different zones attached should be compared, and it is easy enough to convert them to UTCTime using zonedTimeToUTC and compare the results if that's what's intended.

like image 133
kosmikus Avatar answered Oct 21 '22 16:10

kosmikus