hashable-time 0.1.0.1 → 0.2
raw patch · 3 files changed
+83/−38 lines, 3 filesdep +old-localedep ~basedep ~hashabledep ~timePVP ok
version bump matches the API change (PVP)
Dependencies added: old-locale
Dependency ranges changed: base, hashable, time
API changes (from Hackage documentation)
- Data.Hashable.Time: instance Constructor C1_0Day
- Data.Hashable.Time: instance Constructor C1_0Fixed
- Data.Hashable.Time: instance Constructor C1_0LocalTime
- Data.Hashable.Time: instance Constructor C1_0TimeOfDay
- Data.Hashable.Time: instance Constructor C1_0TimeZone
- Data.Hashable.Time: instance Constructor C1_0UTCTime
- Data.Hashable.Time: instance Constructor C1_0UniversalTime
- Data.Hashable.Time: instance Constructor C1_0ZonedTime
- Data.Hashable.Time: instance Datatype D1Day
- Data.Hashable.Time: instance Datatype D1Fixed
- Data.Hashable.Time: instance Datatype D1LocalTime
- Data.Hashable.Time: instance Datatype D1TimeOfDay
- Data.Hashable.Time: instance Datatype D1TimeZone
- Data.Hashable.Time: instance Datatype D1UTCTime
- Data.Hashable.Time: instance Datatype D1UniversalTime
- Data.Hashable.Time: instance Datatype D1ZonedTime
- Data.Hashable.Time: instance Generic (Fixed a)
- Data.Hashable.Time: instance Generic Day
- Data.Hashable.Time: instance Generic LocalTime
- Data.Hashable.Time: instance Generic TimeOfDay
- Data.Hashable.Time: instance Generic TimeZone
- Data.Hashable.Time: instance Generic UTCTime
- Data.Hashable.Time: instance Generic UniversalTime
- Data.Hashable.Time: instance Generic ZonedTime
- Data.Hashable.Time: instance Selector S1_0_0Day
- Data.Hashable.Time: instance Selector S1_0_0LocalTime
- Data.Hashable.Time: instance Selector S1_0_0TimeOfDay
- Data.Hashable.Time: instance Selector S1_0_0TimeZone
- Data.Hashable.Time: instance Selector S1_0_0UTCTime
- Data.Hashable.Time: instance Selector S1_0_0UniversalTime
- Data.Hashable.Time: instance Selector S1_0_0ZonedTime
- Data.Hashable.Time: instance Selector S1_0_1LocalTime
- Data.Hashable.Time: instance Selector S1_0_1TimeOfDay
- Data.Hashable.Time: instance Selector S1_0_1TimeZone
- Data.Hashable.Time: instance Selector S1_0_1UTCTime
- Data.Hashable.Time: instance Selector S1_0_1ZonedTime
- Data.Hashable.Time: instance Selector S1_0_2TimeOfDay
- Data.Hashable.Time: instance Selector S1_0_2TimeZone
+ 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: instance Hashable TimeLocale
Files
- README.md +1/−0
- hashable-time.cabal +24/−15
- src/Data/Hashable/Time.hs +58/−23
+ README.md view
@@ -0,0 +1,1 @@+# hashable-time
hashable-time.cabal view
@@ -1,25 +1,34 @@--- Initial hashable-time.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/- name: hashable-time-version: 0.1.0.1+version: 0.2 synopsis: Hashable instances for Data.Time--- description: +description:+ Hashable instances for types in Data.Time license: BSD3 license-file: LICENSE-author: Alexey Karakulov-maintainer: ankarakulov@gmail.com--- copyright: +author: Alexey Karakulov <ankarakulov@gmail.com>+maintainer: Alexey Karakulov <ankarakulov@gmail.com> category: Data build-type: Simple--- extra-source-files: cabal-version: >=1.10+tested-with: GHC==7.8.4, GHC==7.10.2+extra-source-files: README.md +flag old-locale+ manual: False+ default: False+ library exposed-modules: Data.Hashable.Time- -- other-modules: - -- other-extensions: - build-depends: base >=4.7 && <4.9, hashable, time- hs-source-dirs: src- default-language: Haskell2010- ghc-options: -Wall+ hs-source-dirs: src+ default-language: Haskell2010+ ghc-options: -Wall+ other-extensions: CPP+ build-depends: base >=4.7 && <4.9, hashable >=1.2.3.3 && <=1.3+ if flag(old-locale)+ build-depends: time >=1.4 && <1.5, old-locale >=1.0 && <1.1+ else+ build-depends: time >=1.5++source-repository head+ type: git+ location: https://github.com/w3rs/hashable-time
src/Data/Hashable/Time.hs view
@@ -1,41 +1,76 @@-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-}--module Data.Hashable.Time () where+-- |+-- 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.Fixed import Data.Hashable (Hashable(..)) import Data.Time-import GHC.Generics (Generic) +#if !MIN_VERSION_time(1,5,0)+import System.Locale+#endif +-- Dependencies++-- ! (>=1.2.4) ~ <1.2.4 ~ <= 1.2.3+#if !MIN_VERSION_hashable(1,2,4)+-- https://github.com/tibbe/hashable/pull/101+instance Hashable (Fixed a) where+ hashWithSalt salt (MkFixed i) = hashWithSalt salt i+#endif++-- Data.Time.Clock++instance Hashable UniversalTime where+ hashWithSalt salt = hashWithSalt salt . getModJulianDate+ instance Hashable DiffTime where- hashWithSalt s = hashWithSalt s . toRational+ hashWithSalt salt = hashWithSalt salt . toRational +instance Hashable UTCTime where+ hashWithSalt salt (UTCTime d dt) =+ salt `hashWithSalt` d `hashWithSalt` dt+ instance Hashable NominalDiffTime where- hashWithSalt s = hashWithSalt s . toRational+ hashWithSalt salt = hashWithSalt salt . toRational -deriving instance Generic (Fixed a)-instance Hashable (Fixed a)+-- Data.Time.Calendar -deriving instance Generic Day-instance Hashable Day+instance Hashable Day where+ hashWithSalt salt (ModifiedJulianDay d) = hashWithSalt salt d -deriving instance Generic TimeOfDay-instance Hashable TimeOfDay+-- Data.Time.LocalTime -deriving instance Generic UTCTime-instance Hashable UTCTime+instance Hashable TimeZone where+ hashWithSalt salt (TimeZone m s n) =+ salt `hashWithSalt` m `hashWithSalt` s `hashWithSalt` n -deriving instance Generic UniversalTime-instance Hashable UniversalTime+instance Hashable TimeOfDay where+ hashWithSalt salt (TimeOfDay h m s) =+ salt `hashWithSalt` h `hashWithSalt` m `hashWithSalt` s -deriving instance Generic TimeZone-instance Hashable TimeZone+instance Hashable LocalTime where+ hashWithSalt salt (LocalTime d tod) =+ salt `hashWithSalt` d `hashWithSalt` tod -deriving instance Generic LocalTime-instance Hashable LocalTime+instance Hashable ZonedTime where+ hashWithSalt salt (ZonedTime lt tz) =+ salt `hashWithSalt` lt `hashWithSalt` tz -deriving instance Generic ZonedTime-instance Hashable ZonedTime+-- 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