packages feed

time-recurrence 0.6 → 0.6.1

raw patch · 4 files changed

+8/−27 lines, 4 files

Files

src/Data/Time/CalendarTime/CalendarTime.hs view
@@ -19,7 +19,6 @@ import Data.Time.Calendar.Month import Data.Time.Calendar.WeekDay import Data.Time.Moment.StartOfWeek-import System.IO.Unsafe  -- | A representation of calendar time separated into year, month, day, and so on. data CalendarTime = CalendarTime @@ -39,13 +38,11 @@ class CalendarTimeConvertible t where   -- | Convert to a 'CalendarTime'   toCalendarTime :: t -> CalendarTime-  toCalendarTimeWithTimeZone :: t -> TimeZone -> CalendarTime   -- | Convert from a 'CalendarTime'   fromCalendarTime :: CalendarTime -> Maybe t  instance CalendarTimeConvertible CalendarTime where   toCalendarTime = id-  toCalendarTimeWithTimeZone ct tz = ct { calendarTimeZone = tz }   fromCalendarTime = Just . id  -- | Convert to a 'Day'@@ -86,32 +83,15 @@       (TimeOfDay hh mm ss) = timeToTimeOfDay utcTime       (y, m, d, weekDay, yearDay) = dayInfo utcDay -  toCalendarTimeWithTimeZone utcTime tz | tz == utc = toCalendarTime utcTime-                                        | otherwise = error ("UTCTime.toCalendarTimeWithTimeZone cannot be represented with time zone " ++ show tz)-   fromCalendarTime t = do     day <- toDay t     time <- toTimeOfDay t     return $ UTCTime day (timeOfDayToTime time) -instance CalendarTimeConvertible LocalTime where-  toCalendarTime _ = error ("LocalTime.toCalendarTime cannot be represented without a time zone")--  toCalendarTimeWithTimeZone (LocalTime day t) tz = CalendarTime (fromEnum $ todSec t) (todMin t) (todHour t) d (toEnum m) y weekDay yearDay tz-    where-      (y, m, d, weekDay, yearDay) = dayInfo day--  fromCalendarTime t = do-    day <- toDay t-    time <- toTimeOfDay t-    return $ LocalTime day time- instance CalendarTimeConvertible ZonedTime where   toCalendarTime (ZonedTime (LocalTime day t) tz) = CalendarTime (fromEnum $ todSec t) (todMin t) (todHour t) d (toEnum m) y weekDay yearDay tz     where       (y, m, d, weekDay, yearDay) = dayInfo day--  toCalendarTimeWithTimeZone (ZonedTime lt _) tz = toCalendarTime (ZonedTime lt tz)    fromCalendarTime t = do     day <- toDay t
src/Data/Time/Recurrence/Schedule.hs view
@@ -41,7 +41,7 @@ import Control.Monad.Reader import Data.List as L import Data.List.Ordered as O-import Data.Maybe (mapMaybe, fromJust)+import Data.Maybe (mapMaybe) import Data.Time.Calendar.Month import Data.Time.Calendar.WeekDay import Data.Time.CalendarTime hiding (withDay)@@ -154,7 +154,7 @@ enumHours hours as = return $ concatMap (enumHours' hours) as   where     enumHours' hours a = mapMaybe (withHour a) (hours' a hours)-    hours' a = mapMaybe $ normalizeOrdinalIndex 23+    hours' _ = mapMaybe $ normalizeOrdinalIndex 23  enumMinutes ::   (CalendarTimeConvertible a, Moment a) =>@@ -164,7 +164,7 @@ enumMinutes ms as = return $ concatMap (enumMinutes' ms) as   where     enumMinutes' ms a = mapMaybe (withMinute a) (ms' a ms)-    ms' a = mapMaybe $ normalizeOrdinalIndex 59+    ms' _ = mapMaybe $ normalizeOrdinalIndex 59  enumSeconds ::   (CalendarTimeConvertible a, Moment a) => @@ -174,7 +174,7 @@ enumSeconds secs as = return $ concatMap (enumSeconds' secs) as   where     enumSeconds' secs a = mapMaybe (withSecond a) (secs' a secs)-    secs' a = mapMaybe $ normalizeOrdinalIndex 60+    secs' _ = mapMaybe $ normalizeOrdinalIndex 60  groupWith :: (Ord b) => (a -> b) -> [a] -> [[a]] groupWith f = groupBy (\a b -> f a == f b)
tests/Tests.lhs view
@@ -24,6 +24,7 @@ We are certain of the validity of the dates used, and so fromJust is safe to use. +> date1, date2, date3, date4 :: UTCTime > parse822Time :: String -> UTCTime > parse822Time = zonedTimeToUTC  >              . fromJust 
time-recurrence.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version:             0.6+Version:             0.6.1  -- A short (one-line) description of the package. Synopsis:            Generate recurring dates.@@ -61,7 +61,7 @@  Library   hs-source-dirs:      src-  ghc-options:         -Wall -fno-warn-name-shadowing+  ghc-options:         -Wall -fno-warn-name-shadowing -fno-warn-orphans    -- Modules exported by the library.   Exposed-modules:@@ -96,7 +96,7 @@   type:                 exitcode-stdio-1.0   hs-source-dirs:       src, tests   main-is:              Tests.lhs-  ghc-options:          -Wall -fno-warn-name-shadowing+  ghc-options:          -Wall -fno-warn-name-shadowing -fno-warn-orphans   build-depends:        base >= 4 && < 5,                         time >= 1.4.0.1 && < 1.5,                         data-ordlist >= 0.4 && < 0.4.5,