foldl 1.1.0 → 1.1.1
raw patch · 2 files changed
+9/−2 lines, 2 filesdep ~vectorPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: vector
API changes (from Hackage documentation)
Files
- foldl.cabal +2/−2
- src/Control/Foldl.hs +7/−0
foldl.cabal view
@@ -1,5 +1,5 @@ Name: foldl-Version: 1.1.0+Version: 1.1.1 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -27,7 +27,7 @@ primitive < 0.7 , text >= 0.11.2.0 && < 1.3 , transformers >= 0.2.0.0 && < 0.5 ,- vector >= 0.7 && < 0.11,+ vector >= 0.7 && < 0.12, containers < 0.6, profunctors < 5.2 Exposed-Modules:
src/Control/Foldl.hs view
@@ -16,6 +16,13 @@ >>> import Control.Applicative >>> let average = (/) <$> L.sum <*> L.genericLength + Taking the sum, the sum of squares, ..., upto the sum of x^5++>>> import Data.Traversable+>>> let powerSums = sequenceA [premap (^n) L.sum | n <- [1..5]]+>>> L.fold powerSums [1..10]+[55,385,3025,25333,220825]+ These combined folds will still traverse the list only once, streaming efficiently over the list in constant space without space leaks: