hashable-time-0.2.0.2/0000755000000000000000000000000000000000000012503 5ustar0000000000000000hashable-time-0.2.0.2/LICENSE0000644000000000000000000000277200000000000013520 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.2/README.md0000755000000000000000000000036000000000000013764 0ustar0000000000000000# hashable-time [![Build Status](https://secure.travis-ci.org/w3rs/hashable-time.svg?branch=master)](http://travis-ci.org/w3rs/hashable-time) https://hackage.haskell.org/package/hashable-time Hashable instances for types in `Data.Time`. hashable-time-0.2.0.2/Setup.hs0000644000000000000000000000005600000000000014140 0ustar0000000000000000import Distribution.Simple main = defaultMain hashable-time-0.2.0.2/hashable-time.cabal0000644000000000000000000000203000000000000016165 0ustar0000000000000000name: hashable-time version: 0.2.0.2 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 extra-source-files: README.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.1 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.13, 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.2/src/Data/Hashable/0000755000000000000000000000000000000000000015652 5ustar0000000000000000hashable-time-0.2.0.2/src/Data/Hashable/Time.hs0000644000000000000000000000376200000000000017114 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