validity-time 0.4.0.0 → 0.5.0.0
raw patch · 8 files changed
+62/−56 lines, 8 filessetup-changed
Files
- LICENSE +1/−1
- Setup.hs +0/−3
- src/Data/Validity/Time.hs +4/−3
- src/Data/Validity/Time/Calendar.hs +10/−0
- src/Data/Validity/Time/Clock.hs +6/−7
- src/Data/Validity/Time/Format.hs +14/−19
- src/Data/Validity/Time/LocalTime.hs +24/−18
- validity-time.cabal +3/−5
LICENSE view
@@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2020 Tom Sydney Kerckhove+Copyright (c) 2016-2021 Tom Sydney Kerckhove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
− Setup.hs
@@ -1,3 +0,0 @@-import Distribution.Simple--main = defaultMain
src/Data/Validity/Time.hs view
@@ -1,9 +1,10 @@-{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-dodgy-exports #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Validity.Time- ( module X- ) where+ ( module X,+ )+where import qualified Data.Validity.Time.Calendar as X () import qualified Data.Validity.Time.Clock as X ()
src/Data/Validity/Time/Calendar.hs view
@@ -11,3 +11,13 @@ mconcat [ delve "toModifiedJulianDay" i ]++instance Validity CalendarDiffDays where+ validate (CalendarDiffDays ms ds) =+ mconcat+ [ delve "cdMonths" ms,+ delve "cdDays" ds+ ]++instance Validity DayOfWeek where+ validate = trivialValidation
src/Data/Validity/Time/Clock.hs view
@@ -1,11 +1,10 @@-{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE RecordWildCards #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Validity.Time.Clock where -import Data.Validity- import Data.Time.Clock+import Data.Validity import Data.Validity.Time.Calendar () -- | Valid according to the 'Rational' it contains.@@ -19,10 +18,10 @@ 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."+ [ 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 where
src/Data/Validity/Time/Format.hs view
@@ -1,27 +1,22 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#if MIN_VERSION_time(1,5,0) {-# LANGUAGE RecordWildCards #-}-#endif+{-# OPTIONS_GHC -fno-warn-orphans #-}+ module Data.Validity.Time.Format where-#if MIN_VERSION_time(1,5,0)-import Data.Validity import Data.Time.Format-+import Data.Validity import Data.Validity.Time.LocalTime () -- | Valid according to the contained values instance Validity TimeLocale where- validate TimeLocale {..} =- mconcat- [ annotate wDays $ "wDays"- , annotate months $ "months"- , annotate amPm $ "amPm"- , annotate dateTimeFmt $ "dateTimeFmt"- , annotate dateFmt $ "dateFmt"- , annotate timeFmt $ "timeFmt"- , annotate time12Fmt $ "time12Fmt"- , annotate knownTimeZones $ "knownTimeZones"- ]-#endif+ validate TimeLocale {..} =+ mconcat+ [ annotate wDays "wDays",+ annotate months "months",+ annotate amPm "amPm",+ annotate dateTimeFmt "dateTimeFmt",+ annotate dateFmt "dateFmt",+ annotate timeFmt "timeFmt",+ annotate time12Fmt "time12Fmt",+ annotate knownTimeZones "knownTimeZones"+ ]
src/Data/Validity/Time/LocalTime.hs view
@@ -1,21 +1,20 @@-{-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE RecordWildCards #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Validity.Time.LocalTime where -import Data.Validity- import Data.Time.LocalTime-+import Data.Validity import Data.Validity.Time.Calendar ()+import Data.Validity.Time.Clock () -- | Valid according to the contained values. instance Validity TimeZone where validate TimeZone {..} = mconcat- [ annotate timeZoneMinutes "timeZoneMinutes"- , annotate timeZoneSummerOnly "timeZoneSummerOnly"- , annotate timeZoneName "timeZoneName"+ [ annotate timeZoneMinutes "timeZoneMinutes",+ annotate timeZoneSummerOnly "timeZoneSummerOnly",+ annotate timeZoneName "timeZoneName" ] -- | Valid according to the validity of contained values and these constraints:@@ -26,15 +25,15 @@ 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."+ [ 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@@ -47,6 +46,13 @@ instance Validity ZonedTime where validate ZonedTime {..} = mconcat- [ annotate zonedTimeToLocalTime "zonedTimeToLocalTime"- , annotate zonedTimeZone "zonedTimeZone"+ [ annotate zonedTimeToLocalTime "zonedTimeToLocalTime",+ annotate zonedTimeZone "zonedTimeZone"+ ]++instance Validity CalendarDiffTime where+ validate CalendarDiffTime {..} =+ mconcat+ [ annotate ctMonths "ctMonths",+ annotate ctTime "ctTime" ]
validity-time.cabal view
@@ -1,20 +1,18 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: 67c39e6553361815461677f4654e3cb4541d1ace7c248f665a324de744f950b7 name: validity-time-version: 0.4.0.0+version: 0.5.0.0 synopsis: Validity instances for time category: Validity homepage: https://github.com/NorfairKing/validity#readme bug-reports: https://github.com/NorfairKing/validity/issues author: Tom Sydney Kerckhove maintainer: syd@cs-syd.eu-copyright: Copyright: (c) 2017-2020 Tom Sydney Kerckhove+copyright: Copyright: (c) 2016-2021 Tom Sydney Kerckhove license: MIT license-file: LICENSE build-type: Simple