packages feed

counter 0.1.0.0 → 0.1.0.1

raw patch · 3 files changed

+36/−37 lines, 3 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,20 +1,19 @@-Copyright (c) 2014 Wei En+Copyright (c) 2014 Ng Wei En -Permission is hereby granted, free of charge, to any person obtaining-a copy of this software and associated documentation files (the-"Software"), to deal in the Software without restriction, including-without limitation the rights to use, copy, modify, merge, publish,-distribute, sublicense, and/or sell copies of the Software, and to-permit persons to whom the Software is furnished to do so, subject to-the following conditions:+Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included-in all copies or substantial portions of the Software.+The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.
counter.cabal view
@@ -1,5 +1,5 @@ name:          counter-version:       0.1.0.0+version:       0.1.0.1 synopsis:      An object frequency counter. description:   This project provides an efficient object frequency counter, based upon Data.Map.Strict. homepage:      https://github.com/wei2912/counter@@ -16,8 +16,8 @@ cabal-version: >=1.10  library-  exposed-modules:   Data.Counter-  build-depends:     base >=4.7 && <4.8,+  build-depends:     base >=4.8 && <4.9,                      containers >=0.5 && <0.6+  exposed-modules:   Data.Counter   hs-source-dirs:    src    default-language:  Haskell2010
src/Data/Counter.hs view
@@ -20,7 +20,7 @@   instance of a key. -} singleton ::-	Num v+    Num v     => k -- ^ Key to be inserted.     -> Counter k v -- ^ New counter. singleton k = M.singleton k 1@@ -30,38 +30,38 @@   with a specified value. -} updateWith ::-	(Ord k, Num v)-	=> k -- ^ Key to be inserted.-	-> v -- ^ Specified frequency count.-	-> Counter k v -- ^ Old counter.-	-> Counter k v -- ^ New counter.+    (Ord k, Num v)+    => k -- ^ Key to be inserted.+    -> v -- ^ Specified frequency count.+    -> Counter k v -- ^ Old counter.+    -> Counter k v -- ^ New counter. updateWith = M.insertWith (+)  {-|   Increment the frequency count of a key by 1. -} update ::-	(Ord k, Num v)-	=> k -- ^ Key to be inserted.-	-> Counter k v -- ^ Old counter.-	-> Counter k v -- ^ New counter.+    (Ord k, Num v)+    => k -- ^ Key to be inserted.+    -> Counter k v -- ^ Old counter.+    -> Counter k v -- ^ New counter. update k = updateWith k 1  {-|   Convert a list of items into a counter. -} count ::-	(Ord k, Num v)-	=> [k] -- ^ List of keys.-	-> Counter k v -- ^ New counter.+    (Ord k, Num v)+    => [k] -- ^ List of keys.+    -> Counter k v -- ^ New counter. count = L.foldl' (flip update) M.empty  {-|   Returns the union of two counters. -} union ::-	(Ord k, Num v)-	=> Counter k v -- ^ First counter.-	-> Counter k v -- ^ Second counter.-	-> Counter k v -- ^ Union of both counters.+    (Ord k, Num v)+    => Counter k v -- ^ First counter.+    -> Counter k v -- ^ Second counter.+    -> Counter k v -- ^ Union of both counters. union = M.unionWith (+)