packages feed

nonempty-containers 0.3.4.1 → 0.3.4.2

raw patch · 6 files changed

+58/−6 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,6 +1,15 @@ Changelog ========= +Version 0.3.4.2+----------++*August 25, 2021*++<https://github.com/mstksg/nonempty-containers/releases/tag/v0.3.4.2>++*   Compatibility with GHC 9. (@andremarianiello)+ Version 0.3.4.1 ---------- 
nonempty-containers.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: da5f8ed9003a7dab25c32dfaa59717a40a3575aeebb7ddaa8f6f97613d435220+-- hash: af05370c135085af4252c99e5575aa4ba9ebe2bf244c46bffaee55772a7ccb53  name:           nonempty-containers-version:        0.3.4.1+version:        0.3.4.2 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/Internal.hs view
@@ -181,7 +181,7 @@     1 -> k (z fromList)     _ -> error "gunfold"   dataTypeOf _   = intMapDataType-  dataCast1      = gcast1+  dataCast1 f    = gcast1 f  fromListConstr :: Constr fromListConstr = mkConstr intMapDataType "fromList" [] Prefix@@ -562,10 +562,17 @@ -- elements in order of ascending keys, while 'IntMap' traverses positive -- keys first, then negative keys. instance Foldable1 NEIntMap where+#if MIN_VERSION_base(4,11,0)+    fold1 (NEIntMap _ v m) = maybe v (v <>)+                           . F.foldMap Just+                           . M.elems+                           $ m+#else     fold1 (NEIntMap _ v m) = option v (v <>)                            . F.foldMap (Option . Just)                            . M.elems                            $ m+#endif     {-# INLINE fold1 #-}     foldMap1 f = foldMapWithKey (const f)     {-# INLINE foldMap1 #-}
src/Data/Map/NonEmpty/Internal.hs view
@@ -182,7 +182,7 @@       1 -> k (z fromList)       _ -> error "gunfold"     dataTypeOf _   = mapDataType-    dataCast2      = gcast2+    dataCast2 f    = gcast2 f  fromListConstr :: Constr fromListConstr = mkConstr mapDataType "fromList" [] Prefix@@ -275,9 +275,15 @@     => (k -> a -> m)     -> NEMap k a     -> m+#if MIN_VERSION_base(4,11,0)+foldMapWithKey f (NEMap k0 v m) = maybe (f k0 v) (f k0 v <>)+                                . M.foldMapWithKey (\k -> Just . f k)+                                $ m+#else foldMapWithKey f (NEMap k0 v m) = option (f k0 v) (f k0 v <>)                                 . M.foldMapWithKey (\k -> Option . Just . f k)                                 $ m+#endif {-# INLINE foldMapWithKey #-}  -- | /O(n)/. Map a function over all values in the map.@@ -545,9 +551,15 @@  -- | Traverses elements in order of ascending keys instance Foldable1 (NEMap k) where+#if MIN_VERSION_base(4,11,0)+    fold1 (NEMap _ v m) = maybe v (v <>)+                        . F.foldMap Just+                        $ m+#else     fold1 (NEMap _ v m) = option v (v <>)                         . F.foldMap (Option . Just)                         $ m+#endif     {-# INLINE fold1 #-}     foldMap1 f = foldMapWithKey (const f)     {-# INLINE foldMap1 #-}
src/Data/Sequence/NonEmpty/Internal.hs view
@@ -185,7 +185,7 @@     gunfold k z _   = k (k (z (:<||)))     toConstr _      = consConstr     dataTypeOf _    = seqDataType-    dataCast1       = gcast1+    dataCast1 f     = gcast1 f  consConstr :: Constr consConstr  = mkConstr seqDataType ":<||" [] Infix@@ -317,9 +317,15 @@ -- a folding function that also depends on the element's index, and applies -- it to every element in the sequence. foldMapWithIndex :: Semigroup m => (Int -> a -> m) -> NESeq a -> m+#if MIN_VERSION_base(4,11,0)+foldMapWithIndex f (x :<|| xs) = maybe (f 0 x) (f 0 x <>)+                               . Seq.foldMapWithIndex (\i -> Just . f (i + 1))+                               $ xs+#else foldMapWithIndex f (x :<|| xs) = option (f 0 x) (f 0 x <>)                                . Seq.foldMapWithIndex (\i -> Option . Just . f (i + 1))                                $ xs+#endif {-# INLINE foldMapWithIndex #-}  -- | /O(n)/. 'traverseWithIndex1' is a version of 'traverse1' that also@@ -467,9 +473,15 @@     {-# INLINE length #-}  instance Foldable1 NESeq where+#if MIN_VERSION_base(4,11,0)+    fold1 (x :<|| xs) = maybe x (x <>)+                      . F.foldMap Just+                      $ xs+#else     fold1 (x :<|| xs) = option x (x <>)                       . F.foldMap (Option . Just)                       $ xs+#endif     {-# INLINE fold1 #-}     foldMap1 f = foldMapWithIndex (const f)     {-# INLINE foldMap1 #-}
src/Data/Set/NonEmpty/Internal.hs view
@@ -153,7 +153,7 @@     1 -> k (z fromList)     _ -> error "gunfold"   dataTypeOf _   = setDataType-  dataCast1      = gcast1+  dataCast1 f    = gcast1 f  fromListConstr :: Constr fromListConstr = mkConstr setDataType "fromList" [] Prefix@@ -377,6 +377,17 @@  -- | Traverses elements in ascending order instance Foldable1 NESet where+#if MIN_VERSION_base(4,11,0)+    fold1 (NESet x s) = maybe x (x <>)+                      . F.foldMap Just+                      $ s+    {-# INLINE fold1 #-}+    -- TODO: benchmark against maxView-based method+    foldMap1 f (NESet x s) = maybe (f x) (f x <>)+                           . F.foldMap (Just . f)+                           $ s+    {-# INLINE foldMap1 #-}+#else     fold1 (NESet x s) = option x (x <>)                       . F.foldMap (Option . Just)                       $ s@@ -386,6 +397,7 @@                            . F.foldMap (Option . Just . f)                            $ s     {-# INLINE foldMap1 #-}+#endif     toNonEmpty = toList     {-# INLINE toNonEmpty #-}