Hugs has a bug in Time. I would expect toUTCTime and toCalendarTime to be inverses of toClockTime (modulo the IO monad). toCalendarTime :: ClockTime -> IO CalendarTime toUTCTime :: ClockTime -> CalendarTime toClockTime :: CalendarTime -> ClockTime module Main(main) where import Time main = putStrLn "Hello" test :: Integer -> IO () test x = (toCalendarTime . toClockTime . f $ x) >>= putStrLn . show f x = CalendarTime{ctYear=2002, ctMonth=May, ctDay=30, ctHour=10, ctMin=27, ctSec=11, ctPicosec=x, ctWDay=Thursday, ctYDay=149, ctTZName="BST", ctTZ=3600, ctIsDST=True} GHC gives: Main> test 1 CalendarTime{ctYear=2002,ctMonth=May,ctDay=30,ctHour=10,ctMin=27,ctSec=11,ct Picose c=1,ctWDay=Thursday,ctYDay=149,ctTZName="BST",ctTZ=3600,ctIsDST=True} Main> test 2 CalendarTime{ctYear=2002,ctMonth=May,ctDay=30,ctHour=10,ctMin=27,ctSec=11,ct Picose c=2,ctWDay=Thursday,ctYDay=149,ctTZName="BST",ctTZ=3600,ctIsDST=True} Hugs gives Main> test 1 CalendarTime{ctYear=2002,ctMonth=May,ctDay=30,ctHour=10,ctMin=27,ctSec=11,ct Picose c=0,ctWDay=Thursday,ctYDay=149,ctTZName="BST",ctTZ=3600,ctIsDST=True} Main> test 2 CalendarTime{ctYear=2002,ctMonth=May,ctDay=30,ctHour=10,ctMin=27,ctSec=11,ct Picose c=0,ctWDay=Thursday,ctYDay=149,ctTZName="BST",ctTZ=3600,ctIsDST=True} Dominic Steinitz
participants (1)
-
Dominic Steinitz