hashable-time-0.2.0.1/src/0000755000000000000000000000000013071406207013330 5ustar0000000000000000hashable-time-0.2.0.1/src/Data/0000755000000000000000000000000013071406207014201 5ustar0000000000000000hashable-time-0.2.0.1/src/Data/Hashable/0000755000000000000000000000000013071406207015710 5ustar0000000000000000hashable-time-0.2.0.1/src/Data/Hashable/Time.hs0000644000000000000000000000376213071406207017152 0ustar0000000000000000{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- | -- Module : Data.Hashable.Time -- Description : Hashable instances for Data.Time types -- License : BSD3 -- Maintainer : Alexey Karakulov module Data.Hashable.Time (Hashable(..)) where import Data.Fixed import Data.Hashable (Hashable(..)) import Data.Time #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 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 -- 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 hashable-time-0.2.0.1/LICENSE0000644000000000000000000000277213071406207013556 0ustar0000000000000000Copyright (c) 2015, Alexey Karakulov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Alexey Karakulov nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. hashable-time-0.2.0.1/Setup.hs0000644000000000000000000000005613071406207014176 0ustar0000000000000000import Distribution.Simple main = defaultMain hashable-time-0.2.0.1/hashable-time.cabal0000644000000000000000000000175013071406266016240 0ustar0000000000000000name: hashable-time version: 0.2.0.1 synopsis: Hashable instances for Data.Time description: Hashable instances for types in Data.Time license: BSD3 license-file: LICENSE author: Alexey Karakulov maintainer: Alexey Karakulov category: Data build-type: Simple 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 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall other-extensions: CPP build-depends: base >=4.7 && <4.11, 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 hashable-time-0.2.0.1/README.md0000644000000000000000000000002013071406207014010 0ustar0000000000000000# hashable-time