subG 0.5.0.0 → 0.5.1.0
raw patch · 3 files changed
+9/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- Data/SubG/Unfold.hs +4/−4
- subG.cabal +1/−1
CHANGELOG.md view
@@ -43,3 +43,7 @@ ## 0.5.0.0 -- 2021-06-28 * Fifth version. Added a new module Data.SubG.Unfold inspired by: https://www.works-hub.com/learn/number-anamorphisms-aka-unfolds-explained-50e1a by Marty Stumpf.++## 0.5.1.0 -- 2021-06-28++* Fifth version revised A. Changed the code for Data.SubG.Unfold.unfoldG function influenced more by the Data.List.unfoldr code.
Data/SubG/Unfold.hs view
@@ -14,7 +14,6 @@ ) where import Data.SubG-import Data.Maybe (isJust, fromJust) import Data.Monoid -- | Inspired by: https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.OldList.html#words@@ -23,9 +22,10 @@ -- Also inspired by: https://www.works-hub.com/learn/number-anamorphisms-aka-unfolds-explained-50e1a by Marty Stumpf. -- Generalizes the 'Data.List.unfoldr' function not only for lists, but for the data type that has 'InsertLeft' and 'Monoid' instances. unfoldG :: (InsertLeft t a, Monoid (t a)) => (a -> Maybe (a, a)) -> a -> t a-unfoldG p x- | isJust (p x) = x %@ unfoldG p (snd . fromJust . p $ x)- | otherwise = mempty+unfoldG p x =+ case p x of+ Just (y, z) -> x %@ unfoldG p z+ Nothing -> mempty -- | Inspired by: https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.OldList.html#words -- and: Graham Hutton. A tutorial on the universality and expressiveness of fold. /J. Functional Programming/ 9 (4): 355–372, July 1999.
subG.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: subG-version: 0.5.0.0+version: 0.5.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