
From: Keean Schupke [mailto:k.schupke@imperial.ac.uk]
data Gregorian = Gregorian { second :: Int, minute :: Int, hour :: Int, dayOfMonth :: Int, dayOfWeek :: Int, weekOfYear :: Int, monthOfYear :: Int, Year :: Int } -- enumerations may make more sense for dayOfWeek/monthOfYear
I don't like the redundancy here. dayOfWeek and weekOfYear can (and should) be derived from the dayOfMonth+monthOfYear+year. Having to specify them in addition to the other fields is a major PITA, and one of the reasons the current CalendarTime library is so unsavoury (why do I need to say what day of the week it is? pah). Alistair. ----------------------------------------- ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. *****************************************************************

Bayley, Alistair wrote:
From: Keean Schupke [mailto:k.schupke@imperial.ac.uk]
data Gregorian = Gregorian { second :: Int, minute :: Int, hour :: Int, dayOfMonth :: Int, dayOfWeek :: Int, weekOfYear :: Int, monthOfYear :: Int, Year :: Int } -- enumerations may make more sense for dayOfWeek/monthOfYear
I don't like the redundancy here. dayOfWeek and weekOfYear can (and should) be derived from the dayOfMonth+monthOfYear+year. Having to specify them in addition to the other fields is a major PITA, and one of the reasons the current CalendarTime library is so unsavoury (why do I need to say what day of the week it is? pah).
Alistair.
For some functions it makes sense, for reverse calculations (Calendar -> TAI) it can save a lot of time to just fill out some fields... I was thinking of cron like functionality where you want to represent a repeat time (like every monday at 8pm)... But this would require each field to have a type like: data Gregorian = Gregorian { second :: [Int], minute :: [Int], hour :: [Int], dayOfMonth :: [Int], dayOfWeek :: [Int], weekOfYear :: [Int], monthOfYear :: [Int], year :: [Int] } anytime = { second = [], minute = [], hour = [], dayOfMonth = [], dayOfWeek = [], weekOfYear = [], monthOfYear = [], year = [] } recordMyProgram = anytime { dayOfWeek = [1,3], hour = [21] } So my program gets recorded every monday and wednesday at 9pm. Keean.
participants (2)
-
Bayley, Alistair
-
Keean Schupke