hashable-orphans (empty) → 0
raw patch · 5 files changed
+87/−0 lines, 5 filesdep +basedep +hashabledep +sorted-listsetup-changed
Dependencies added: base, hashable, sorted-list, time
Files
- ChangeLog.md +5/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- hashable-orphans.cabal +34/−0
- src/Data/Hashable/Orphans.hs +16/−0
+ ChangeLog.md view
@@ -0,0 +1,5 @@+# Revision history for hashable-orphans++## 0 -- YYYY-mm-dd++* First version. Released on an unsuspecting world.
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2017, davean++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 davean 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.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ hashable-orphans.cabal view
@@ -0,0 +1,34 @@+-- Initial hashable-orphans.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/++name: hashable-orphans+version: 0+synopsis: Provides instances missing from Hashable.+homepage: https://oss.xkcd.com/+license: BSD3+license-file: LICENSE+author: davean+maintainer: oss@xkcd.com+copyright: davean 2017+category: Data+build-type: Simple+extra-source-files: ChangeLog.md+cabal-version: >=1.10+description: This package provides instances missing from <http://hackage.haskell.org/package/hashable hashable>, specificly ones for types from <http://hackage.haskell.org/package/time time> ('DiffTime', 'UTCTime') and <http://hackage.haskell.org/package/sorted-list sorted-list> at present.++source-repository head+ type: git+ location: https://code.xkrd.net/davean/hashable-orphans.git++library+ hs-source-dirs: src+ default-language: Haskell2010+ exposed-modules:+ Data.Hashable.Orphans + build-depends:+ base >=4.9 && <4.11+ , hashable >= 1.2 && < 1.3+ , sorted-list >= 0.2 && < 0.3+ , time >= 1.6 && < 1.9++
+ src/Data/Hashable/Orphans.hs view
@@ -0,0 +1,16 @@+module Data.Hashable.Orphans () where++import Data.Hashable (Hashable(hashWithSalt))+import Data.Foldable+import Data.SortedList+import Data.Time++instance Hashable DiffTime where+ hashWithSalt s = hashWithSalt s . diffTimeToPicoseconds++instance Hashable UTCTime where+ hashWithSalt s (UTCTime (ModifiedJulianDay d) dt) =+ hashWithSalt s (d, dt)++instance Hashable a => Hashable (SortedList a) where+ hashWithSalt s = hashWithSalt s . toList