extra 1.7.11 → 1.7.12
raw patch · 4 files changed
+17/−7 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Foldable.Extra: notNull :: Foldable f => f a -> Bool
Files
- CHANGES.txt +5/−0
- extra.cabal +1/−1
- src/Data/Foldable/Extra.hs +5/−0
- src/Data/Tuple/Extra.hs +6/−6
CHANGES.txt view
@@ -1,5 +1,10 @@ Changelog for Extra +1.7.12, released 2022-09-02+ #98, make both lazy in its argument+ #98, make first3,second3,third3 lazy in their argument+ #98, make firstM,secondM lazy in their argument+ #86, add notNull for Foldable 1.7.11, released 2022-08-21 #95, add List.repeatedlyNE and NonEmpty.repeatedly #94, add groupOnKey
extra.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.18 build-type: Simple name: extra-version: 1.7.11+version: 1.7.12 license: BSD3 license-file: LICENSE category: Development
src/Data/Foldable/Extra.hs view
@@ -1,5 +1,6 @@ module Data.Foldable.Extra ( module Data.Foldable+ , notNull , sum' , product' , sumOn'@@ -14,6 +15,10 @@ import Data.Foldable import qualified Control.Monad.Extra as MX++-- | Composition of 'not' and 'null'+notNull :: Foldable f => f a -> Bool+notNull = not . null -- | A generalization of 'Data.List.Extra.sum'' to 'Foldable' instances. sum' :: (Foldable f, Num a) => f a -> a
src/Data/Tuple/Extra.hs view
@@ -38,13 +38,13 @@ -- -- > firstM (\x -> [x-1, x+1]) (1,"test") == [(0,"test"),(2,"test")] firstM :: Functor m => (a -> m a') -> (a, b) -> m (a', b)-firstM f (a,b) = (,b) <$> f a+firstM f ~(a,b) = (,b) <$> f a -- | Update the second component of a pair. -- -- > secondM (\x -> [reverse x, x]) (1,"test") == [(1,"tset"),(1,"test")] secondM :: Functor m => (b -> m b') -> (a, b) -> m (a, b')-secondM f (a,b) = (a,) <$> f b+secondM f ~(a,b) = (a,) <$> f b -- | Given two functions, apply one to the first component and one to the second. -- A specialised version of 'Control.Arrow.***'.@@ -70,7 +70,7 @@ -- -- > both succ (1,2) == (2,3) both :: (a -> b) -> (a, a) -> (b, b)-both f (x,y) = (f x, f y)+both f ~(x,y) = (f x, f y) -- | Extract the 'fst' of a triple. fst3 :: (a,b,c) -> a@@ -97,16 +97,16 @@ -- -- > first3 succ (1,1,1) == (2,1,1) first3 :: (a -> a') -> (a, b, c) -> (a', b, c)-first3 f (a,b,c) = (f a,b,c)+first3 f ~(a,b,c) = (f a,b,c) -- | Update the second component of a triple. -- -- > second3 succ (1,1,1) == (1,2,1) second3 :: (b -> b') -> (a, b, c) -> (a, b', c)-second3 f (a,b,c) = (a,f b,c)+second3 f ~(a,b,c) = (a,f b,c) -- | Update the third component of a triple. -- -- > third3 succ (1,1,1) == (1,1,2) third3 :: (c -> c') -> (a, b, c) -> (a, b, c')-third3 f (a,b,c) = (a,b,f c)+third3 f ~(a,b,c) = (a,b,f c)