subG 0.4.0.0 → 0.4.1.0
raw patch · 3 files changed
+19/−1 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.SubG: filterG :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a
+ Data.SubG: mapG :: (InsertLeft t b, Monoid (t b)) => (a -> b) -> t a -> t b
Files
- CHANGELOG.md +4/−0
- Data/SubG.hs +14/−0
- subG.cabal +1/−1
CHANGELOG.md view
@@ -31,3 +31,7 @@ * Fourth version. Added new modules Data.MinMax3Plus.Preconditions and Data.MinMax.Preconditions with additional functions. Added -By functions to the modules to make them more general. The modules with Preconditions in the names just use functions with no checking the needed length of the structure.++## 0.4.1.0 -- 2020-11-19++* Fourth version revised A. Added two new functions mapG and filterG to the module.
Data/SubG.hs view
@@ -31,6 +31,8 @@ , safeTailG , safeInitG , safeLastG+ , mapG+ , filterG ) where import Prelude hiding (dropWhile, span, takeWhile)@@ -217,3 +219,15 @@ -- | If the structure is empty, just returns 'Nothing'. safeLastG :: (InsertLeft t a, Monoid (t a)) => t a -> Maybe a safeLastG = F.find (const True) . takeFromEndG 1++-----------------------------------------------------------------------------++-- | Inspired by: Graham Hutton. A tutorial on the universality and expressiveness of fold. /J. Functional Programming/ 9 (4): 355–372, July 1999.+-- that is available at the URL: https://www.cs.nott.ac.uk/~pszgmh/fold.pdf. Acts similarly to the 'map' function from Prelude.+mapG :: (InsertLeft t b, Monoid (t b)) => (a -> b) -> t a -> t b+mapG f = F.foldr (\x ys -> f x %@ ys) mempty++-- | Inspired by: Graham Hutton. A tutorial on the universality and expressiveness of fold. /J. Functional Programming/ 9 (4): 355–372, July 1999.+-- that is available at the URL: https://www.cs.nott.ac.uk/~pszgmh/fold.pdf. Acts similarly to 'filter' function from Prelude.+filterG :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a+filterG p = F.foldr (\x ys -> if p x then x %@ ys else ys) mempty
subG.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: subG-version: 0.4.0.0+version: 0.4.1.0 synopsis: Some extension to the Foldable and Monoid classes. description: Introduces a new class InsertLeft -- the class of types of values that can be inserted from the left to the Foldable structure that is a data that is also the Monoid instance. Also contains some functions to find out both minimum and maximum elements of the finite Foldable structures. homepage: https://hackage.haskell.org/package/subG