packages feed

sdp-hashable (empty) → 0.2

raw patch · 4 files changed

+127/−0 lines, 4 filesdep +basedep +hashabledep +sdpsetup-changed

Dependencies added: base, hashable, sdp

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Andrey Mulik (c) 2020++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 Andrey Mulik 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
+ sdp-hashable.cabal view
@@ -0,0 +1,45 @@+name:          sdp-hashable+version:       0.2+category:      Data Structures++synopsis:      Hashable instances for SDP+description:   Hashable support for SDP structures++author:        Andrey Mulik+maintainer:    <work.a.mulik@gmail.com>+bug-reports:   https://github.com/andreymulik/sdp-hashable/issues++copyright:     2020 Andrey Mulik+license-file:  LICENSE+license:       BSD3++build-type:    Simple+cabal-version: >=1.10++source-repository head+  type: git+  location: https://github.com/andreymulik/sdp-hashable++---            _      _____ ______ ______   ___  ______ __   __              ---+---           | |    |_   _|| ___ \| ___ \ / _ \ | ___ \\ \ / /              ---+---           | |      | |  | |_/ /| |_/ // /_\ \| |_/ / \ V /               ---+---           | |      | |  | ___ \|    / |  _  ||    /   \ /                ---+---           | |____ _| |_ | |_/ /| |\ \ | | | || |\ \   | |                ---+---           \_____/ \___/ \____/ \_| \_|\_| |_/\_| \_|  \_/                ---++Library+  default-language: Haskell2010+  hs-source-dirs:   src+  +  build-depends:+    base     >= 4.12    && < 5,+    sdp      >= 0.2     && < 1,+    hashable >= 1.1.1.0 && < 1.4+  +  ghc-options: -Wall -Wno-orphans+  +  exposed-modules:+    SDP.Hashable+++
+ src/SDP/Hashable.hs view
@@ -0,0 +1,50 @@+{-# LANGUAGE MagicHash, FlexibleInstances #-}++{- |+    Module      :  SDP.Hashable+    Copyright   :  (c) Andrey Mulik 2020+    License     :  BSD-style+    Maintainer  :  work.a.mulik@gmail.com+    Portability :  portable+    +    @SDP.Hashable@ provides 'Hashable' instances for @sdp@ structures.+-}+module SDP.Hashable+  (+    -- * Export+    module Data.Hashable+  )+where++import Prelude ()+import SDP.SafePrelude+import SDP.Templates.AnyBorder+import SDP.Templates.AnyChunks+import SDP.Prim.SArray+import SDP.Prim.SBytes++import Data.Hashable++default ()++--------------------------------------------------------------------------------++instance (Hashable e) => Hashable (SArray# e)+  where+    hashWithSalt = foldl' hashWithSalt++instance (Unboxed e) => Hashable (SBytes# e)+  where+    hashWithSalt = hashSBytesWith#++instance (Hashable (rep e), Hashable i, Index i) => Hashable (AnyBorder rep i e)+  where+    hashWithSalt salt (AnyBorder _ _ rep) = salt `hashWithSalt` rep++instance (Nullable (rep e), Hashable (rep e)) => Hashable (AnyChunks rep e)+  where+    hashWithSalt salt = foldl' hashWithSalt salt . toChunks++++