nonempty-containers 0.3.4.2 → 0.3.4.3
raw patch · 8 files changed
+28/−8 lines, 8 files
Files
- CHANGELOG.md +10/−0
- nonempty-containers.cabal +2/−2
- src/Data/IntMap/NonEmpty.hs +3/−1
- src/Data/IntSet/NonEmpty.hs +3/−1
- src/Data/Map/NonEmpty.hs +3/−1
- src/Data/Sequence/NonEmpty.hs +3/−1
- src/Data/Set/NonEmpty.hs +3/−1
- test/Tests/Util.hs +1/−1
CHANGELOG.md view
@@ -1,6 +1,16 @@ Changelog ========= +Version 0.3.4.3+----------++*August 25, 2021*++<https://github.com/mstksg/nonempty-containers/releases/tag/v0.3.4.3>++* Fix `intersperse` for singleton non-empty sequences. (@eddiemundo)+* Fix `deleteMax` for singleton containers.+ Version 0.3.4.2 ----------
nonempty-containers.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: af05370c135085af4252c99e5575aa4ba9ebe2bf244c46bffaee55772a7ccb53+-- hash: c6b3bfa5e2f51136fd5cd80ba3505719544753478e23f5114f6c718a42120786 name: nonempty-containers-version: 0.3.4.2+version: 0.3.4.3 synopsis: Non-empty variants of containers data types, with full API description: Efficient and optimized non-empty versions of types from /containers/. Inspired by /non-empty-containers/ library, except attempting a more
src/Data/IntMap/NonEmpty.hs view
@@ -1800,7 +1800,9 @@ -- > deleteMax (fromList ((5,"a") :| [(3,"b"), (7,"c")])) == Data.IntMap.fromList [(3,"b"), (5,"a")] -- > deleteMax (singleton 5 "a") == Data.IntMap.empty deleteMax :: NEIntMap a -> IntMap a-deleteMax (NEIntMap k v m) = insertMinMap k v . M.deleteMax $ m+deleteMax (NEIntMap k v m) = case M.maxView m of+ Nothing -> M.empty+ Just (_, m') -> insertMinMap k v m' {-# INLINE deleteMax #-} -- | /O(1)/ if delete, /O(log n)/ otherwise. Update the value at the
src/Data/IntSet/NonEmpty.hs view
@@ -700,7 +700,9 @@ -- > deleteMax (fromList (5 :| [3, 7])) == Data.IntSet.fromList [3, 5] -- > deleteMax (singleton 5) == Data.IntSet.empty deleteMax :: NEIntSet -> IntSet-deleteMax (NEIntSet x s) = insertMinSet x . S.deleteMax $ s+deleteMax (NEIntSet x s) = case S.maxView s of+ Nothing -> S.empty+ Just (_, s') -> insertMinSet x s' {-# INLINE deleteMax #-} -- | /O(1)/. Delete and find the minimal element. It is constant-time, so
src/Data/Map/NonEmpty.hs view
@@ -2203,7 +2203,9 @@ -- > deleteMax (fromList ((5,"a") :| [(3,"b"), (7,"c")])) == Data.Map.fromList [(3,"b"), (5,"a")] -- > deleteMax (singleton 5 "a") == Data.Map.empty deleteMax :: NEMap k a -> Map k a-deleteMax (NEMap k v m) = insertMinMap k v . M.deleteMax $ m+deleteMax (NEMap k v m) = case M.maxView m of+ Nothing -> M.empty+ Just (_, m') -> insertMinMap k v m' {-# INLINE deleteMax #-} -- | /O(1)/ if delete, /O(log n)/ otherwise. Update the value at the
src/Data/Sequence/NonEmpty.hs view
@@ -957,7 +957,9 @@ -- intersperse a (fromList [x,y,z]) = fromList [x,a,y,a,z] -- @ intersperse :: a -> NESeq a -> NESeq a-intersperse z (x :<|| xs) = x :<|| (z Seq.<| Seq.intersperse z xs)+intersperse z nes@(x :<|| xs) = case xs of+ _ Seq.:<| _ -> x :<|| (z Seq.<| Seq.intersperse z xs)+ Seq.Empty -> nes {-# INLINE intersperse #-} -- | \( O(\min(n_1,n_2,n_3)) \). 'zip3' takes three sequences and returns a
src/Data/Set/NonEmpty.hs view
@@ -974,7 +974,9 @@ -- > deleteMax (fromList (5 :| [3, 7])) == Data.Set.fromList [3, 5] -- > deleteMax (singleton 5) == Data.Set.empty deleteMax :: NESet a -> Set a-deleteMax (NESet x s) = insertMinSet x . S.deleteMax $ s+deleteMax (NESet x s) = case S.maxView s of+ Nothing -> S.empty+ Just (_, s') -> insertMinSet x s' {-# INLINE deleteMax #-} -- | /O(1)/. Delete and find the minimal element. It is constant-time, so
test/Tests/Util.hs view
@@ -514,7 +514,7 @@ valGen = Gen.text (Range.linear 0 5) Gen.alphaNum mapSize :: Range Int-mapSize = Range.exponential 4 8+mapSize = Range.exponential 1 8 mapGen :: MonadGen m => m (Map KeyType Text) mapGen = Gen.map mapSize $ (,) <$> keyGen <*> valGen