intern 0.9.2 → 0.9.3
raw patch · 7 files changed
+38/−8 lines, 7 filesdep ~bytestringPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: bytestring
API changes (from Hackage documentation)
- Data.Interned.IntSet: instance Data.Semigroup.Semigroup Data.Interned.IntSet.IntSet
+ Data.Interned.IntSet: instance Data.Hashable.Class.Hashable Data.Interned.IntSet.IntSet
+ Data.Interned.IntSet: instance GHC.Base.Semigroup Data.Interned.IntSet.IntSet
+ Data.Interned.Internal.ByteString: instance Data.Hashable.Class.Hashable Data.Interned.Internal.ByteString.InternedByteString
+ Data.Interned.Internal.String: instance Data.Hashable.Class.Hashable Data.Interned.Internal.String.InternedString
+ Data.Interned.Internal.Text: instance Data.Hashable.Class.Hashable Data.Interned.Internal.Text.InternedText
- Data.Interned.Internal: CacheState :: {-# UNPACK #-} !Id -> !(HashMap (Description t) t) -> CacheState t
+ Data.Interned.Internal: CacheState :: {-# UNPACK #-} !Id -> !HashMap (Description t) t -> CacheState t
- Data.Interned.Internal: [content] :: CacheState t -> !(HashMap (Description t) t)
+ Data.Interned.Internal: [content] :: CacheState t -> !HashMap (Description t) t
Files
- CHANGELOG.markdown +5/−0
- Data/Interned/IntSet.hs +13/−4
- Data/Interned/Internal.hs +3/−0
- Data/Interned/Internal/ByteString.hs +3/−0
- Data/Interned/Internal/String.hs +3/−0
- Data/Interned/Internal/Text.hs +3/−0
- intern.cabal +8/−4
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.9.3 [2020.09.30]+------------------+* Add `Hashable` instances for `InternedString`, `InternedByteString`,+ `InternedText`, and `IntSet`.+ 0.9.2 ----- * Add a `Semigroup IntSet` instance.
Data/Interned/IntSet.hs view
@@ -111,17 +111,21 @@ import Prelude hiding (lookup,filter,foldr,foldl,null,map) import qualified Data.List as List-import Data.Monoid (Monoid(..)) import Data.Maybe (fromMaybe)-#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0))-import Data.Semigroup (Semigroup(..))-#endif import Data.Interned.Internal import Data.Bits import Data.Hashable import Text.Read import GHC.Exts ( Word(..), Int(..), shiftRL# ) +#if !(MIN_VERSION_base(4,8,0))+import Data.Monoid (Monoid(..))+#endif++#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0))+import Data.Semigroup (Semigroup(..))+#endif+ -- import Data.Typeable -- import Data.Data (Data(..), mkNoRepType) @@ -855,6 +859,11 @@ showsPrec p xs = showParen (p > 10) $ showString "fromList " . shows (toList xs) +{--------------------------------------------------------------------+ Hashable+--------------------------------------------------------------------}+instance Hashable IntSet where+ hashWithSalt s x = hashWithSalt s $ identity x {-------------------------------------------------------------------- Read
Data/Interned/Internal.hs view
@@ -2,6 +2,7 @@ , FlexibleInstances , FlexibleContexts , BangPatterns+ , CPP , GeneralizedNewtypeDeriving #-} module Data.Interned.Internal@@ -20,7 +21,9 @@ import Data.Hashable import Data.HashMap.Strict (HashMap) import Data.Foldable+#if !(MIN_VERSION_base(4,8,0)) import Data.Traversable+#endif import qualified Data.HashMap.Strict as HashMap import Data.IORef import GHC.IO (unsafeDupablePerformIO, unsafePerformIO)
Data/Interned/Internal/ByteString.hs view
@@ -26,6 +26,9 @@ instance Show InternedByteString where showsPrec d (InternedByteString _ b) = showsPrec d b +instance Hashable InternedByteString where+ hashWithSalt s (InternedByteString i _) = hashWithSalt s i+ instance Interned InternedByteString where type Uninterned InternedByteString = ByteString newtype Description InternedByteString = DBS ByteString deriving (Eq,Hashable)
Data/Interned/Internal/String.hs view
@@ -25,6 +25,9 @@ instance Show InternedString where showsPrec d (IS _ b) = showsPrec d b +instance Hashable InternedString where+ hashWithSalt s (IS i _) = hashWithSalt s i+ instance Interned InternedString where type Uninterned InternedString = String data Description InternedString = Cons {-# UNPACK #-} !Char String | Nil
Data/Interned/Internal/Text.hs view
@@ -25,6 +25,9 @@ instance Show InternedText where showsPrec d (InternedText _ b) = showsPrec d b +instance Hashable InternedText where+ hashWithSalt s (InternedText i _) = hashWithSalt s i+ instance Interned InternedText where type Uninterned InternedText = Text newtype Description InternedText = DT Text deriving (Eq)
intern.cabal view
@@ -1,8 +1,8 @@ name: intern category: Data, Data Structures-version: 0.9.2+version: 0.9.3 license: BSD3-cabal-version: >= 1.6+cabal-version: >= 1.10 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett <ekmett@gmail.com>@@ -19,7 +19,10 @@ , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2- , GHC == 8.4.1+ , GHC == 8.4.4+ , GHC == 8.6.5+ , GHC == 8.8.3+ , GHC == 8.10.1 synopsis: Efficient hash-consing for arbitrary data types description: Efficient hash-consing for arbitrary data types. @@ -34,7 +37,7 @@ base >= 4 && < 5, bytestring >= 0.9 && < 0.11, text >= 0.11 && < 1.3,- hashable >= 1.1 && < 1.3,+ hashable >= 1.1 && < 1.4, unordered-containers >= 0.2.1 && < 0.3, array >= 0.3 && < 0.6 @@ -50,3 +53,4 @@ Data.Interned.Internal.Text ghc-options: -Wall+ default-language: Haskell2010