packages feed

validity-time 0.2.0.3 → 0.3.0.0

raw patch · 3 files changed

+39/−45 lines, 3 files

Files

src/Data/Validity/Time/Clock.hs view
@@ -10,24 +10,20 @@  -- | Valid according to the 'Rational' it contains. instance Validity UniversalTime where-    validate = delve "toModifiedJulianDay" . getModJulianDate+  validate = delve "toModifiedJulianDay" . getModJulianDate  -- | Trivially valid instance Validity DiffTime where-    validate = trivialValidation+  validate = trivialValidation  instance Validity UTCTime where-    validate UTCTime {..} =-        mconcat-            [ annotate utctDay "utctDay"-            , annotate utctDayTime "utctDayTime"-            , check (utctDayTime >= 0) "The day time is positive."-            , check-                  (utctDayTime < 86401)-                  "The day time is strictly less than 86401."-            ]+  validate UTCTime {..} =+    mconcat+      [ annotate utctDay "utctDay"+      , annotate utctDayTime "utctDayTime"+      , check (utctDayTime >= 0) "The day time is positive."+      , check (utctDayTime < 86401) "The day time is strictly less than 86401."+      ] -instance Validity NominalDiffTime-    -- NominalDiffTime contains a 'Pico' but that constructorr is not exported so we can't do any better than this.-                                                                                                                    where-    validate ndt = annotate ((round :: NominalDiffTime -> Integer) ndt) "round"+instance Validity NominalDiffTime where+  validate = trivialValidation
src/Data/Validity/Time/LocalTime.hs view
@@ -11,12 +11,12 @@  -- | Valid according to the contained values. instance Validity TimeZone where-    validate TimeZone {..} =-        mconcat-            [ annotate timeZoneMinutes "timeZoneMinutes"-            , annotate timeZoneSummerOnly "timeZoneSummerOnly"-            , annotate timeZoneName "timeZoneName"-            ]+  validate TimeZone {..} =+    mconcat+      [ annotate timeZoneMinutes "timeZoneMinutes"+      , annotate timeZoneSummerOnly "timeZoneSummerOnly"+      , annotate timeZoneName "timeZoneName"+      ]  -- | Valid according to the validity of contained values and these constraints: --@@ -24,31 +24,29 @@ --  * todMin : range 0 - 59 --  * todSec : 0 <= todSec < 61, instance Validity TimeOfDay where-    validate TimeOfDay {..} =-        mconcat-            [ annotate todHour "todHour"-            , check (todHour >= 0) "The 'hour' is positive."-            , check (todHour <= 23) "The 'hour' is 23 or less."-            , annotate todMin "todMin"-            , check (todMin >= 0) "The 'minute' is positive."-            , check (todMin <= 59) "The 'minute' is 59 or less."-            , annotate todSec "todSec"-            , check (todSec >= 0) "The 'second' is positive."-            , check (todSec < 61) "The 'second' is 60 or less."-            ]+  validate TimeOfDay {..} =+    mconcat+      [ annotate todHour "todHour"+      , check (todHour >= 0) "The 'hour' is positive."+      , check (todHour <= 23) "The 'hour' is 23 or less."+      , annotate todMin "todMin"+      , check (todMin >= 0) "The 'minute' is positive."+      , check (todMin <= 59) "The 'minute' is 59 or less."+      , annotate todSec "todSec"+      , check (todSec >= 0) "The 'second' is positive."+      , check (todSec < 61) "The 'second' is 60 or less."+      ]  -- | Valid according to the validity of contained values instance Validity LocalTime where-    validate LocalTime {..} =-        mconcat-            [ annotate localDay "localDay"-            , annotate localTimeOfDay "localTimeOfDay"-            ]+  validate LocalTime {..} =+    mconcat+      [annotate localDay "localDay", annotate localTimeOfDay "localTimeOfDay"]  -- | Valid according to the validity of contained values instance Validity ZonedTime where-    validate ZonedTime {..} =-        mconcat-            [ annotate zonedTimeToLocalTime "zonedTimeToLocalTime"-            , annotate zonedTimeZone "zonedTimeZone"-            ]+  validate ZonedTime {..} =+    mconcat+      [ annotate zonedTimeToLocalTime "zonedTimeToLocalTime"+      , annotate zonedTimeZone "zonedTimeZone"+      ]
validity-time.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 34bf1aa8675c937c93958e6500cd23b70561bd03efbe8689b9efe948bbb97257+-- hash: 2f223a022ffad5d68447105e51ff44ba42c33f631eaa88f5bdf3df65abf41942  name:           validity-time-version:        0.2.0.3+version:        0.3.0.0 synopsis:       Validity instances for time category:       Validity homepage:       https://github.com/NorfairKing/validity#readme