ordered-containers 0.0 → 0.1.0
raw patch · 5 files changed
+27/−16 lines, 5 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Map.Ordered: filter :: (k -> v -> Bool) -> OMap k v -> OMap k v
+ Data.Map.Ordered: filter :: Ord k => (k -> v -> Bool) -> OMap k v -> OMap k v
- Data.Set.Ordered: filter :: (a -> Bool) -> OSet a -> OSet a
+ Data.Set.Ordered: filter :: Ord a => (a -> Bool) -> OSet a -> OSet a
Files
- ChangeLog.md +8/−2
- Data/Map/Ordered.hs +6/−4
- Data/Map/Util.hs +2/−2
- Data/Set/Ordered.hs +9/−6
- ordered-containers.cabal +2/−2
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for ordered-containers -## 0.0 -- YYYY-mm-dd+## 0.1.0 -- 2016-12-26 -* First version. Released on an unsuspecting world.+* Documentation fix+* Live up to the package version boundary claims+* Use enough version parts to conform to the PVP++## 0.0 -- 2016-12-23++* First version released on an unsuspecting world
Data/Map/Ordered.hs view
@@ -27,7 +27,7 @@ import Control.Applicative ((<|>)) import Control.Monad (guard)-import Data.Foldable (Foldable(foldl', foldMap))+import Data.Foldable (Foldable, foldl', foldMap) import Data.Function (on) import Data.Map (Map) import Data.Map.Util (Index, Tag, maxTag, minTag, nextHigherTag, nextLowerTag, readsPrecList, showsPrecList)@@ -67,7 +67,7 @@ (\\) :: Ord k => OMap k v -> OMap k v' -> OMap k v o@(OMap tvs kvs) \\ o'@(OMap tvs' kvs') = if size o < size o' then filter (const . (`notMember` o')) o- else foldr delete o (fst <$> assocs o')+ else foldr delete o (fmap fst (assocs o')) empty :: OMap k v empty = OMap M.empty M.empty@@ -92,11 +92,13 @@ notMember k (OMap tvs _) = M.notMember k tvs lookup :: Ord k => k -> OMap k v -> Maybe v-lookup k (OMap tvs _) = snd <$> M.lookup k tvs+lookup k (OMap tvs _) = fmap snd (M.lookup k tvs) +-- The Ord constraint is for compatibility with older (<0.5) versions of+-- containers. -- | @filter f m@ contains exactly the key-value pairs of @m@ that satisfy @f@, -- without changing the order they appear-filter :: (k -> v -> Bool) -> OMap k v -> OMap k v+filter :: Ord k => (k -> v -> Bool) -> OMap k v -> OMap k v filter f (OMap tvs kvs) = OMap (M.filterWithKey (\k (t, v) -> f k v) tvs) (M.filterWithKey (\t (k, v) -> f k v) kvs)
Data/Map/Util.hs view
@@ -17,8 +17,8 @@ nextHigherTag = maybe 0 succ . maxTag minTag, maxTag :: Map Tag a -> Maybe Tag-minTag m = fst . fst <$> M.minViewWithKey m-maxTag m = fst . fst <$> M.maxViewWithKey m+minTag m = fmap (fst . fst) (M.minViewWithKey m)+maxTag m = fmap (fst . fst) (M.maxViewWithKey m) showsPrecList :: Show a => (b -> [a]) -> Int -> b -> ShowS showsPrecList toList d o = showParen (d > 10) $
Data/Set/Ordered.hs view
@@ -25,11 +25,12 @@ ) where import Control.Monad (guard)-import Data.Foldable (Foldable(foldl', foldMap, toList))+import Data.Foldable (Foldable, foldl', foldMap, foldr, toList) import Data.Function (on) import Data.Map (Map) import Data.Map.Util (Index, Tag, maxTag, minTag, nextHigherTag, nextLowerTag, readsPrecList, showsPrecList)-import Prelude hiding (filter, lookup, null)+import Data.Set (Set) -- so the haddocks link to the right place+import Prelude hiding (filter, foldr, lookup, null) import qualified Data.Map as M data OSet a = OSet !(Map a Tag) !(Map Tag a)@@ -81,8 +82,8 @@ bump' = case minTag vs' of Nothing -> 0 Just k -> -k- tsBumped = (bump +) <$> ts- tsBumped' = (bump'+) <$> ts'+ tsBumped = fmap (bump +) ts+ tsBumped' = fmap (bump'+) ts' vsBumped = (bump +) `M.mapKeysMonotonic` vs vsBumped' = (bump'+) `M.mapKeysMonotonic` vs' @@ -103,7 +104,9 @@ size :: OSet a -> Int size (OSet ts _) = M.size ts -filter :: (a -> Bool) -> OSet a -> OSet a+-- the Ord constraint is for compatibility with older (<0.5) versions of+-- containers+filter :: Ord a => (a -> Bool) -> OSet a -> OSet a filter f (OSet ts vs) = OSet (M.filterWithKey (\v t -> f v) ts) (M.filterWithKey (\t v -> f v) vs) @@ -135,4 +138,4 @@ -- | Returns values in ascending order. (Use 'toList' to return them in -- insertion order.) toAscList :: OSet a -> [a]-toAscList o@(OSet ts _) = fst <$> M.toAscList ts+toAscList o@(OSet ts _) = fmap fst (M.toAscList ts)
ordered-containers.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: ordered-containers-version: 0.0+version: 0.1.0 synopsis: Set- and Map-like types that remember the order elements were inserted -- description: license: BSD3@@ -21,5 +21,5 @@ -- other-extensions: build-depends: base >=4 && <5, containers >=0.1 && <0.6 -- hs-source-dirs: - default-language: Haskell2010+ default-language: Haskell98 ghc-options: -fno-warn-tabs