insert-ordered-containers 0.2.4 → 0.2.5
raw patch · 4 files changed
+70/−17 lines, 4 filesdep +deepseqdep ~aesondep ~base-compatdep ~unordered-containersPVP ok
version bump matches the API change (PVP)
Dependencies added: deepseq
Dependency ranges changed: aeson, base-compat, unordered-containers
API changes (from Hackage documentation)
+ Data.HashMap.Strict.InsOrd: instance (Control.DeepSeq.NFData k, Control.DeepSeq.NFData v) => Control.DeepSeq.NFData (Data.HashMap.Strict.InsOrd.InsOrdHashMap k v)
+ Data.HashMap.Strict.InsOrd: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.HashMap.Strict.InsOrd.P a)
+ Data.HashMap.Strict.InsOrd: instance Control.DeepSeq.NFData k => Control.DeepSeq.NFData1 (Data.HashMap.Strict.InsOrd.InsOrdHashMap k)
+ Data.HashMap.Strict.InsOrd: instance Control.DeepSeq.NFData1 Data.HashMap.Strict.InsOrd.P
+ Data.HashMap.Strict.InsOrd: instance Control.DeepSeq.NFData2 Data.HashMap.Strict.InsOrd.InsOrdHashMap
+ Data.HashSet.InsOrd: instance Control.DeepSeq.NFData k => Control.DeepSeq.NFData (Data.HashSet.InsOrd.InsOrdHashSet k)
+ Data.HashSet.InsOrd: instance Control.DeepSeq.NFData1 Data.HashSet.InsOrd.InsOrdHashSet
Files
- CHANGELOG.md +3/−0
- insert-ordered-containers.cabal +22/−15
- src/Data/HashMap/Strict/InsOrd.hs +29/−1
- src/Data/HashSet/InsOrd.hs +16/−1
CHANGELOG.md view
@@ -1,3 +1,6 @@+- 0.2.5+ - Add `NFData(/1/2)` instances+ - 0.2.4 - Add `indexed-traversable` instances - lens-5 and optics-0.4 support
insert-ordered-containers.cabal view
@@ -1,5 +1,5 @@ name: insert-ordered-containers-version: 0.2.4+version: 0.2.5 synopsis: Associative containers retaining insertion order for traversals. @@ -18,7 +18,13 @@ build-type: Simple cabal-version: >=1.10 tested-with:- GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.4 || ==9.0.1+ GHC ==8.0.2+ || ==8.2.2+ || ==8.4.4+ || ==8.6.5+ || ==8.8.4+ || ==8.10.4+ || ==9.0.1 extra-source-files: CHANGELOG.md@@ -33,19 +39,20 @@ hs-source-dirs: src ghc-options: -Wall build-depends:- aeson >=1.4.2.0 && <1.6- , base >=4.9 && <4.16- , base-compat >=0.10.5 && <0.12- , hashable >=1.2.6.1 && <1.4- , indexed-traversable >=0.1.1 && <0.2- , lens >=4.17 && <5.1- , optics-core >=0.2 && <0.5- , optics-extra >=0.2 && <0.5- , semigroupoids >=5.3.2 && <5.4- , semigroups >=0.18.5 && <0.20- , text >=1.2.3.0 && <1.3- , transformers >=0.5.2.0 && <0.6- , unordered-containers >=0.2.8.0 && <0.3+ aeson >=1.4.2.0 && <1.6+ , base >=4.9 && <4.16+ , base-compat >=0.10.5 && <0.12+ , deepseq >=1.4.2.0 && <1.5+ , hashable >=1.2.6.1 && <1.4+ , indexed-traversable >=0.1.1 && <0.2+ , lens >=4.17 && <5.1+ , optics-core >=0.2 && <0.5+ , optics-extra >=0.2 && <0.5+ , semigroupoids >=5.3.2 && <5.4+ , semigroups >=0.18.5 && <0.20+ , text >=1.2.3.0 && <1.3+ , transformers >=0.5.2.0 && <0.6+ , unordered-containers >=0.2.14.0 && <0.3 exposed-modules: Data.HashMap.Strict.InsOrd
src/Data/HashMap/Strict/InsOrd.hs view
@@ -82,6 +82,7 @@ import Control.Applicative (Const (..)) import Control.Arrow (first, second)+import Control.DeepSeq (NFData (..)) import Data.Aeson import qualified Data.Aeson.Encoding as E import Data.Data (Data, Typeable)@@ -113,6 +114,10 @@ import qualified GHC.Exts as Exts +#if MIN_VERSION_deepseq(1,4,3)+import qualified Control.DeepSeq as NF+#endif+ import Data.HashMap.InsOrd.Internal -------------------------------------------------------------------------------@@ -122,6 +127,15 @@ data P a = P !Int !a deriving (Functor, Foldable, Traversable, Typeable, Data) +instance NFData a => NFData (P a) where+ rnf (P _ a) = rnf a++#if MIN_VERSION_deepseq(1,4,3)+-- | @since 0.2.5+instance NF.NFData1 P where+ liftRnf rnf1 (P _ a) = rnf1 a+#endif+ getPK :: P a -> Int getPK (P i _) = i {-# INLINABLE getPK #-}@@ -147,13 +161,27 @@ -- InsOrdHashMap ------------------------------------------------------------------------------- --- | 'HashMap' which tries it's best to remember insertion order of elements.+-- | 'HashMap' which tries its best to remember insertion order of elements. data InsOrdHashMap k v = InsOrdHashMap { _getIndex :: !Int , getInsOrdHashMap :: !(HashMap k (P v)) } deriving (Functor, Typeable, Data)++-- | @since 0.2.5+instance (NFData k, NFData v) => NFData (InsOrdHashMap k v) where+ rnf (InsOrdHashMap _ hm) = rnf hm++#if MIN_VERSION_deepseq(1,4,3)+-- | @since 0.2.5+instance NFData k => NF.NFData1 (InsOrdHashMap k) where+ liftRnf rnf2 = NF.liftRnf2 rnf rnf2++-- | @since 0.2.5+instance NF.NFData2 InsOrdHashMap where+ liftRnf2 rnf1 rnf2 (InsOrdHashMap _ m) = NF.liftRnf2 rnf1 (NF.liftRnf rnf2) m+#endif instance (Eq k, Eq v) => Eq (InsOrdHashMap k v) where InsOrdHashMap _ a == InsOrdHashMap _ b = a == b
src/Data/HashSet/InsOrd.hs view
@@ -47,6 +47,7 @@ import Prelude.Compat hiding (filter, foldr, lookup, map, null) import Control.Arrow (first)+import Control.DeepSeq (NFData (..)) import Data.Aeson import Data.Data (Data, Typeable) import Data.Hashable (Hashable (..))@@ -73,19 +74,33 @@ import qualified Data.Foldable import qualified GHC.Exts as Exts +#if MIN_VERSION_deepseq(1,4,3)+import qualified Control.DeepSeq as NF+#endif+ import Data.HashMap.InsOrd.Internal ------------------------------------------------------------------------------- -- InsOrdHashSet ------------------------------------------------------------------------------- --- | 'HashSet' which tries it's best to remember insertion order of elements.+-- | 'HashSet' which tries its best to remember insertion order of elements. data InsOrdHashSet k = InsOrdHashSet { _getIndex :: !Int , getInsOrdHashSet :: !(HashMap k Int) } deriving (Typeable, Data)++-- | @since 0.2.5+instance NFData k => NFData (InsOrdHashSet k) where+ rnf (InsOrdHashSet _ hs) = rnf hs++#if MIN_VERSION_deepseq(1,4,3)+-- | @since 0.2.5+instance NF.NFData1 InsOrdHashSet where+ liftRnf rnf1 (InsOrdHashSet _ m) = NF.liftRnf2 rnf1 rnf m+#endif instance Eq k => Eq (InsOrdHashSet k) where InsOrdHashSet _ a == InsOrdHashSet _ b = a == b