packages feed

hashable-time 0.2.1 → 0.3

raw patch · 4 files changed

+59/−98 lines, 4 filesdep +hashable-timedep −old-localedep −timedep ~basedep ~hashabledep ~time-compatPVP ok

version bump matches the API change (PVP)

Dependencies added: hashable-time

Dependencies removed: old-locale, time

Dependency ranges changed: base, hashable, time-compat

API changes (from Hackage documentation)

- Data.Hashable.Time: class Hashable a
- Data.Hashable.Time: hash :: Hashable a => a -> Int
- Data.Hashable.Time: hashWithSalt :: Hashable a => Int -> a -> Int
- Data.Hashable.Time: infixl 0 `hashWithSalt`
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Calendar.Days.Day
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Calendar.Month.Compat.Month
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Calendar.Quarter.Compat.Quarter
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Calendar.Quarter.Compat.QuarterOfYear
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Calendar.Week.DayOfWeek
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Clock.Internal.DiffTime.DiffTime
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Clock.Internal.NominalDiffTime.NominalDiffTime
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Clock.Internal.UTCTime.UTCTime
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Clock.Internal.UniversalTime.UniversalTime
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.Format.Locale.TimeLocale
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.LocalTime.Internal.LocalTime.LocalTime
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.LocalTime.Internal.TimeZone.TimeZone
- Data.Hashable.Time: instance Data.Hashable.Class.Hashable Data.Time.LocalTime.Internal.ZonedTime.ZonedTime

Files

changelog.md view
@@ -1,3 +1,16 @@+0.3+---++Package is deprecated. Instances are moved to+[`time-compat`](https://hackage.haskell.org/package/time-compat)+package.++`Hashable ZonedTime` instance is removed, as there is no `Eq Hashable`.+This is in a preparation for making `Eq` a superclass of `Hashable`.++`Data.Hashable.Time` is empty module, i.e .it doesn't re-export `Hashable`+class, but only infects you with the orphan instances.+ 0.2.1 ----- 
hashable-time.cabal view
@@ -1,5 +1,5 @@ name:                hashable-time-version:             0.2.1+version:             0.3 synopsis:            Hashable instances for Data.Time description:   Hashable instances for types in Data.Time@@ -11,11 +11,7 @@ build-type:          Simple cabal-version:       >=1.10 extra-source-files:  README.md changelog.md-tested-with:         GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.3, GHC==8.10.3--flag old-locale-  manual: False-  default: False+tested-with:         GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.3, GHC==8.10.4, GHC==9.0.1  library   exposed-modules:  Data.Hashable.Time@@ -23,14 +19,19 @@   default-language: Haskell2010   ghc-options:      -Wall   other-extensions: CPP-  build-depends:    base >=4.7 && <4.16, hashable >=1.2.4 && <1.4, time-compat >=1.9.4 && <1.10--  if flag(old-locale)-    build-depends:  time >=1.4 && <1.5, old-locale >=1.0 && <1.1-  else-    build-depends:  time >=1.5 && <1.12-+  build-depends:    base >=4.7 && <4.16, time-compat >=1.9.6 && <1.10  source-repository head   type:     git   location: https://github.com/w3rs/hashable-time++test-suite instances+  default-language: Haskell2010+  type:             exitcode-stdio-1.0+  hs-source-dirs:   test-instances+  main-is:          Test.hs+  build-depends:+      base+    , hashable+    , hashable-time+    , time-compat
src/Data/Hashable/Time.hs view
@@ -1,85 +1,2 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--- |--- Module      : Data.Hashable.Time--- Description : Hashable instances for Data.Time types--- License     : BSD3--- Maintainer  : Alexey Karakulov <ankarakulov@gmail.com>-module Data.Hashable.Time (Hashable(..)) where--import Data.Hashable (Hashable(..))-import Data.Time.Compat (UniversalTime (..), DiffTime, UTCTime (..),-                         NominalDiffTime, Day (..), DayOfWeek (..), TimeZone (..),-                         TimeOfDay (..), LocalTime (..), ZonedTime (..))-import Data.Time.Calendar.Month.Compat (Month (..))-import Data.Time.Calendar.Quarter.Compat (Quarter (..), QuarterOfYear (..))---- time-compat doesn't redefine TimeLocale-#ifdef MIN_VERSION_old_locale-import System.Locale (TimeLocale (..))-#else-import Data.Time.Format.Compat (TimeLocale (..))-#endif---- Data.Time.Clock--instance Hashable UniversalTime where-  hashWithSalt salt = hashWithSalt salt . getModJulianDate--instance Hashable DiffTime where-  hashWithSalt salt = hashWithSalt salt . toRational--instance Hashable UTCTime where-  hashWithSalt salt (UTCTime d dt) =-    salt `hashWithSalt` d `hashWithSalt` dt--instance Hashable NominalDiffTime where-  hashWithSalt salt = hashWithSalt salt . toRational---- Data.Time.Calendar--instance Hashable Day where-  hashWithSalt salt (ModifiedJulianDay d) = hashWithSalt salt d--instance Hashable Month where-  hashWithSalt salt (MkMonth x) = hashWithSalt salt x--instance Hashable Quarter where-  hashWithSalt salt (MkQuarter x) = hashWithSalt salt x--instance Hashable DayOfWeek where-  hashWithSalt salt = hashWithSalt salt . fromEnum--instance Hashable QuarterOfYear where-  hashWithSalt salt = hashWithSalt salt . fromEnum---- Data.Time.LocalTime--instance Hashable TimeZone where-  hashWithSalt salt (TimeZone m s n) =-    salt `hashWithSalt` m `hashWithSalt` s `hashWithSalt` n--instance Hashable TimeOfDay where-  hashWithSalt salt (TimeOfDay h m s) =-    salt `hashWithSalt` h `hashWithSalt` m `hashWithSalt` s--instance Hashable LocalTime where-  hashWithSalt salt (LocalTime d tod) =-    salt `hashWithSalt` d `hashWithSalt` tod--instance Hashable ZonedTime where-  hashWithSalt salt (ZonedTime lt tz) =-    salt `hashWithSalt` lt `hashWithSalt` tz---- Data.Time.Locale / System.Locale--instance Hashable TimeLocale where-  hashWithSalt salt (TimeLocale a b c d e f g h) =-    salt `hashWithSalt` a-         `hashWithSalt` b-         `hashWithSalt` c-         `hashWithSalt` d-         `hashWithSalt` e-         `hashWithSalt` f-         `hashWithSalt` g-         `hashWithSalt` h+module Data.Hashable.Time () where+import Data.Time.Format.Compat  ()
+ test-instances/Test.hs view
@@ -0,0 +1,30 @@+module Main where++import Data.Hashable (Hashable)+import Data.Hashable.Time ()+import Data.Time.Compat+import Data.Time.Calendar.Month.Compat+import Data.Time.Calendar.Quarter.Compat++main :: IO ()+main = putStrLn "OK"+ +_HashableInstances :: [()]+_HashableInstances =+    [ test (undefined :: TimeLocale)+    , test (undefined :: LocalTime)+    , test (undefined :: TimeOfDay)+    , test (undefined :: TimeZone)+    , test (undefined :: UniversalTime)+    , test (undefined :: UTCTime)+    , test (undefined :: NominalDiffTime)+    , test (undefined :: DiffTime)+    , test (undefined :: DayOfWeek)+    , test (undefined :: Day)+    , test (undefined :: QuarterOfYear)+    , test (undefined :: Quarter)+    , test (undefined :: Month)+    ]+  where+    test :: Hashable t => t -> ()+    test _ = ()