Unique 0.4.1 → 0.4.2
raw patch · 4 files changed
+49/−21 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/List/Unique.hs +0/−1
- Data/List/UniqueStrict.hs +23/−8
- Data/List/UniqueUnsorted.hs +24/−9
- Unique.cabal +2/−3
Data/List/Unique.hs view
@@ -28,7 +28,6 @@ sort , sortBy , group- , nub ) import Data.List.Extra (nubOrd)
Data/List/UniqueStrict.hs view
@@ -12,15 +12,30 @@ -- Unlike Data.List.Unique this one uses Data.Map.Strict for calculations. -- So it's much faster and it uses less memory. -module Data.List.UniqueStrict- ( repeated- , repeatedBy- , unique- , count- , count_ ) where+module Data.List.UniqueStrict+ (+ repeated+ , repeatedBy+ , unique+ , count+ , count_ )+ where -import qualified Data.Map.Strict as MS (Map (..), fromListWith,toList,filter,keys)-import qualified Data.IntMap.Strict as IM (IntMap (..), fromListWith,toList)+import qualified Data.Map.Strict as MS+ (+ Map+ , fromListWith+ , toList+ , filter+ , keys+ )++import qualified Data.IntMap.Strict as IM+ (+ fromListWith+ , toList+ )+ import qualified Data.List as L (sort) countMap :: Ord a => [a] -> MS.Map a Int
Data/List/UniqueUnsorted.hs view
@@ -14,17 +14,32 @@ -- The elements in the list can be unsorted (do not have an instance of Ord class, but Hashable is needed). -- This implementation is good for ByteStrings. -module Data.List.UniqueUnsorted- ( repeated- , repeatedBy- , unique- , count- , count_ ) where+module Data.List.UniqueUnsorted+ ( repeated+ , repeatedBy+ , unique+ , count+ , count_+ )+ where import Data.Hashable-import qualified Data.HashMap.Strict as HS (HashMap (..),fromListWith,toList,filter,keys)-import qualified Data.IntMap.Strict as IM (IntMap (..), fromListWith,toList)+import qualified Data.HashMap.Strict as HS+ (+ HashMap+ , fromListWith+ , toList+ , filter+ , keys+ ) +import qualified Data.IntMap.Strict as IM+ (+ fromListWith+ , toList+ )++ countMap :: (Hashable a, Eq a) => [a] -> HS.HashMap a Int countMap = HS.fromListWith (+) . flip zip (repeat 1) @@ -62,5 +77,5 @@ count_ :: (Hashable a, Eq a) => [a] -> [(a, Int)] count_ = fromIntMap . toIntMap . HS.toList . countMap- where toIntMap = IM.fromListWith (++) . map (\(x,y) -> (y,[x]))+ where toIntMap = IM.fromListWith (++) . map (\(x,y) -> (y,[x])) fromIntMap = concatMap (\(x,y) -> zip y $ repeat x) . IM.toList
Unique.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.4.1+version: 0.4.2 -- A short (one-line) description of the package. synopsis: It provides the functionality like unix "uniq" utility@@ -64,10 +64,9 @@ , containers , hashable , unordered-containers- -- Directories containing source files. -- hs-source-dirs: -- Base language which the package is written in. default-language: Haskell2010-+ ghc-options: -O2 -Wall -fspec-constr-count=8 -funbox-strict-fields