packages feed

validity-time 0.0.0.1 → 0.1.0.0

raw patch · 5 files changed

+57/−8 lines, 5 filesdep ~validityPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: validity

API changes (from Hackage documentation)

Files

src/Data/Validity/Time/Calendar.hs view
@@ -9,3 +9,4 @@ -- | Valid according to the 'Integer' it contains. instance Validity Day where     isValid (ModifiedJulianDay i) = isValid i+    validate = validateByCheckingName "Day"
src/Data/Validity/Time/Clock.hs view
@@ -11,10 +11,12 @@ -- | Valid according to the 'Rational' it contains. instance Validity UniversalTime where     isValid (ModJulianDate i) = isValid i+    validate = validateByCheckingName "UniversalTime"  -- | Trivially valid instance Validity DiffTime where-    isValid = const True+    isValid = triviallyValid+    validate = validateByCheckingName "DiffTime"  instance Validity UTCTime where     isValid UTCTime {..} =@@ -24,7 +26,16 @@             , utctDayTime >= 0             , utctDayTime < 86401             ]+    validate UTCTime {..} =+        mconcat+            [ utctDay <?!> "utctDay"+            , utctDayTime <?!> "utctDayTime"+            , utctDayTime >= 0 <?@> "The day time is positive."+            , utctDayTime < 86401 <?@> "The day time is strictly less than 86401."+            ] -instance Validity NominalDiffTime where-    isValid = isValid . (round :: NominalDiffTime -> Integer)+instance Validity NominalDiffTime     -- NominalDiffTime contains a 'Pico' but that constructorr is not exported so we can't do any better than this.+                                                                                                                    where+    isValid = isValid . (round :: NominalDiffTime -> Integer)+    validate = validateByCheckingName "NominalDiffTime"
src/Data/Validity/Time/Format.hs view
@@ -1,7 +1,8 @@+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-}+#if MIN_VERSION_time(1,5,0) {-# LANGUAGE RecordWildCards #-}-{-# LANGUAGE CPP #-}-+#endif module Data.Validity.Time.Format where  import Data.Validity@@ -22,5 +23,16 @@             , isValid timeFmt             , isValid time12Fmt             , isValid knownTimeZones+            ]+    validate TimeLocale {..} =+        mconcat+            [ wDays <?!> "wDays"+            , months <?!> "months"+            , amPm <?!> "amPm"+            , dateTimeFmt <?!> "dateTimeFmt"+            , dateFmt <?!> "dateFmt"+            , timeFmt <?!> "timeFmt"+            , time12Fmt <?!> "time12Fmt"+            , knownTimeZones <?!> "knownTimeZones"             ] #endif
src/Data/Validity/Time/LocalTime.hs view
@@ -14,6 +14,12 @@     isValid TimeZone {..} =         isValid timeZoneMinutes &&         isValid timeZoneSummerOnly && isValid timeZoneName+    validate TimeZone {..} =+        mconcat+            [ timeZoneMinutes <?!> "timeZoneMinutes"+            , timeZoneSummerOnly <?!> "timeZoneSummerOnly"+            , timeZoneName <?!> "timeZoneName"+            ]  -- | Valid according to the validity of contained values and these constraints: --@@ -33,12 +39,31 @@             , todSec >= 0             , todSec < 61             ]+    validate TimeOfDay {..} =+        mconcat+            [ todHour <?!> "todHour"+            , todHour >= 0 <?@> "The 'hour' is positive."+            , todHour <= 23 <?@> "The 'hour' is 23 or less."+            , todMin <?!> "todMin"+            , todMin >= 0 <?@> "The 'minute' is positive."+            , todMin <= 59 <?@> "The 'minute' is 59 or less."+            , todSec <?!> "todSec"+            , todSec >= 0 <?@> "The 'second' is positive."+            , todSec < 61 <?@> "The 'second' is 60 or less."+            ]  -- | Valid according to the validity of contained values instance Validity LocalTime where     isValid LocalTime {..} = isValid localDay && isValid localTimeOfDay+    validate LocalTime {..} =+        mconcat [localDay <?!> "localDay", localTimeOfDay <?!> "localTimeOfDay"]  -- | Valid according to the validity of contained values instance Validity ZonedTime where     isValid ZonedTime {..} =         isValid zonedTimeToLocalTime && isValid zonedTimeZone+    validate ZonedTime {..} =+        mconcat+            [ zonedTimeToLocalTime <?!> "zonedTimeToLocalTime"+            , zonedTimeZone <?!> "zonedTimeZone"+            ]
validity-time.cabal view
@@ -1,5 +1,5 @@ name: validity-time-version: 0.0.0.1+version: 0.1.0.0 cabal-version: >=1.10 build-type: Simple license: MIT@@ -25,8 +25,8 @@         Data.Validity.Time.Format         Data.Validity.Time.LocalTime     build-depends:-        base >= 4.7 && <5,-        validity -any,+        base >=4.7 && <5,+        validity >=0.4 && <0.5,         time -any     default-language: Haskell2010     hs-source-dirs: src