packages feed

multiset 0.3.3 → 0.3.4

raw patch · 4 files changed

+59/−8 lines, 4 filesdep +deepseqdep ~base

Dependencies added: deepseq

Dependency ranges changed: base

Files

+ CHANGELOG view
@@ -0,0 +1,19 @@+0.3.4 (2018-05-28)+ * #29: Add Semigroup instances (needed for GHC 8.4)+ * Add NfData instances++0.3.3 (2016-05-30)+ * Document precondition of occurrence > 0 on from*List functions.+ * #18: Compatibility with GHC 8.0+ * #13: Fix warnings about redundant imports+ * #22: Fixed warnings about unnecessary constraints++0.3.2: (2016-01-12)+ * #7: Work around doctest issue of ambiguous modules++0.3.1: (2016-01-11)+ * #4: Fix maxView to use deleteFindMax instead of deleteFindMin++0.3.0: (2015-06-29)+ * #3: Return Maybe instead of `fail`-ing in a monad +
Data/IntMultiSet.hs view
@@ -14,17 +14,17 @@ -- Stability   :  provisional -- Portability :  portable ----- An efficient implementation of multisets of integers, also somtimes called bags.+-- An efficient implementation of multisets of integers, also sometimes called bags. -- -- A multiset is like a set, but it can contain multiple copies of the same element. -- -- Since many function names (but not the type name) clash with -- "Prelude" names, this module is usually imported @qualified@, e.g. ----- >  import Data.MultiSet (MultiSet)--- >  import qualified Data.MultiSet as MultiSet+-- >  import Data.IntMultiSet (IntMultiSet)+-- >  import qualified Data.IntMultiSet as IntMultiSet ----- The implementation of 'MultiSet' is based on the "Data.IntMap" module.+-- The implementation of 'IntMultiSet' is based on the "Data.IntMap" module. -- -- Many operations have a worst-case complexity of /O(min(n,W))/. -- This means that the operation can become linear in the number of@@ -137,6 +137,10 @@ #if __GLASGOW_HASKELL__ < 710 import Data.Monoid (Monoid(..)) #endif+#if MIN_VERSION_base(4,11,0)+import qualified Data.List.NonEmpty (toList)+import Data.Semigroup (Semigroup(..), stimesIdempotentMonoid)+#endif import Data.Typeable () import Data.IntMap.Strict (IntMap) import Data.IntSet (IntSet)@@ -145,6 +149,7 @@ import qualified Data.IntSet as Set import qualified Data.List as List import qualified Data.MultiSet as MultiSet+import Control.DeepSeq (NFData(..))  {- -- just for testing@@ -153,7 +158,9 @@ import qualified List -} +#if __GLASGOW_HASKELL__ < 800 import Data.Typeable+#endif #if __GLASGOW_HASKELL__ import Text.Read import Data.Data (Data(..), mkNoRepType)@@ -187,6 +194,16 @@     mempty  = empty     mappend = union     mconcat = unions++#if MIN_VERSION_base(4,11,0)+instance Semigroup IntMultiSet where+    (<>) = union+    sconcat = unions . Data.List.NonEmpty.toList+    stimes = stimesIdempotentMonoid+#endif++instance NFData IntMultiSet where+    rnf = rnf . unMS  #if __GLASGOW_HASKELL__ 
Data/MultiSet.hs view
@@ -14,7 +14,7 @@ -- Stability   :  provisional -- Portability :  portable ----- An efficient implementation of multisets, also somtimes called bags.+-- An efficient implementation of multisets, also sometimes called bags. -- -- A multiset is like a set, but it can contain multiple copies of the same element. -- Unless otherwise specified all insert and remove opertions affect only a single copy of an element.@@ -143,6 +143,10 @@ #if __GLASGOW_HASKELL__ < 710 import Data.Monoid (Monoid(..)) #endif+#if MIN_VERSION_base(4,11,0)+import qualified Data.List.NonEmpty (toList)+import Data.Semigroup (Semigroup(..), stimesIdempotentMonoid)+#endif import Data.Typeable () import qualified Data.Foldable as Foldable import Data.Map.Strict (Map)@@ -150,6 +154,7 @@ import qualified Data.Map.Strict as Map import qualified Data.Set as Set import qualified Data.List as List+import Control.DeepSeq (NFData(..))  {- -- just for testing@@ -190,8 +195,18 @@     mappend = union     mconcat = unions +#if MIN_VERSION_base(4,11,0)+instance Ord a => Semigroup (MultiSet a) where+    (<>) = union+    sconcat = unions . Data.List.NonEmpty.toList+    stimes = stimesIdempotentMonoid+#endif+ instance Foldable.Foldable MultiSet where     foldr = fold++instance NFData a => NFData (MultiSet a) where+    rnf = rnf . unMS  #if __GLASGOW_HASKELL__ 
multiset.cabal view
@@ -1,5 +1,5 @@ name:             multiset-version:          0.3.3+version:          0.3.4 author:           Twan van Laarhoven maintainer:       twanvl@gmail.com bug-reports:      https://github.com/twanvl/multiset/issues@@ -12,7 +12,7 @@ license-file:     LICENSE build-type:       Simple Cabal-version:    >= 1.10-extra-source-files: include/Typeable.h+extra-source-files: include/Typeable.h CHANGELOG  source-repository head     type:     git@@ -25,7 +25,7 @@   include-dirs:       include   default-extensions: CPP   ghc-options:        -Wall-  build-depends:      containers >= 0.5, base >= 4 && < 5+  build-depends:      containers >= 0.5, base >= 4 && < 5, deepseq >=1.2 && <1.5  test-suite doctests   default-language:   Haskell2010