packages feed

hashable 1.4.0.0 → 1.4.0.1

raw patch · 4 files changed

+30/−3 lines, 4 filesdep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: text

API changes (from Hackage documentation)

Files

CHANGES.md view
@@ -1,5 +1,9 @@ See also https://pvp.haskell.org/faq +## Version 1.4.0.1++ * `text-2.0` compatibility+ ## Version 1.4.0.0   * `Eq` is now a superclass of `Hashable`.
hashable.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.12 name:               hashable-version:            1.4.0.0+version:            1.4.0.1 synopsis:           A class for types that can be converted to a hash value description:   This package defines a class, 'Hashable', for types that@@ -87,7 +87,7 @@     , containers  >=0.4.2.1 && <0.7     , deepseq     >=1.3     && <1.5     , ghc-prim-    , text        >=0.12    && <1.3+    , text        >=1.2.3.0 && <1.3 || >=2.0 && <2.1    if !impl(ghc >=9.2)     build-depends: base-orphans >=0.8.6
src/Data/Hashable/Class.hs view
@@ -722,7 +722,23 @@         hashByteArrayWithSalt ba 0 (BSI.length sbs) (hashWithSalt salt (BSI.length sbs)) #endif +#if MIN_VERSION_text(2,0,0)+ instance Hashable T.Text where+    hashWithSalt salt (T.Text (TA.ByteArray arr) off len) =+        hashByteArrayWithSalt arr off len (hashWithSalt salt len)++instance Hashable TL.Text where+    hashWithSalt salt = finalise . TL.foldlChunks step (SP salt 0)+      where+        finalise (SP s l) = hashWithSalt s l+        step (SP s l) (T.Text (TA.ByteArray arr) off len) = SP+            (hashByteArrayWithSalt arr off len s)+            (l + len)++#else++instance Hashable T.Text where     hashWithSalt salt (T.Text arr off len) =         hashByteArrayWithSalt (TA.aBA arr) (off `shiftL` 1) (len `shiftL` 1)         (hashWithSalt salt len)@@ -734,6 +750,8 @@         step (SP s l) (T.Text arr off len) = SP             (hashByteArrayWithSalt (TA.aBA arr) (off `shiftL` 1) (len `shiftL` 1) s)             (l + len)++#endif  -- | Compute the hash of a ThreadId. hashThreadId :: ThreadId -> Int
tests/Regress.hs view
@@ -48,7 +48,12 @@         hs @=? nub hs #if WORD_SIZE_IN_BITS == 64     , testCase "64 bit Text" $ do-        hash ("hello world" :: Text) @=? -3875242662334356092+        hash ("hello world" :: Text) @=?+#if MIN_VERSION_text(2,0,0)+            4078614214911247440+#else+            -3875242662334356092+#endif #endif     , F.testGroup "concatenation"         [ testCase "String" $ do