deferred-folds 0.9.2 → 0.9.3
raw patch · 2 files changed
+9/−2 lines, 2 filesdep +vectorPVP ok
version bump matches the API change (PVP)
Dependencies added: vector
API changes (from Hackage documentation)
+ DeferredFolds.Unfoldr: vectorWithIndices :: Vector vector a => vector a -> Unfoldr (Int, a)
Files
deferred-folds.cabal view
@@ -1,5 +1,5 @@ name: deferred-folds-version: 0.9.2+version: 0.9.3 category: Folding synopsis: Abstractions over deferred folds description:@@ -42,4 +42,5 @@ containers >=0.5 && <0.6, foldl >=1 && <2, primitive >=0.6.4 && <0.7,- transformers >=0.5 && <0.6+ transformers >=0.5 && <0.6,+ vector >=0.12 && <0.13
library/DeferredFolds/Defs/Unfoldr.hs view
@@ -7,6 +7,7 @@ import qualified Data.IntMap.Strict as IntMap import qualified Data.ByteString as ByteString import qualified Data.ByteString.Short.Internal as ShortByteString+import qualified Data.Vector.Generic as GenericVector deriving instance Functor Unfoldr@@ -133,6 +134,11 @@ then step (index, indexPrimArray pa index) (loop (succ index)) else state in loop 0++{-| Elements of a vector coming paired with indices -}+{-# INLINE vectorWithIndices #-}+vectorWithIndices :: GenericVector.Vector vector a => vector a -> Unfoldr (Int, a)+vectorWithIndices vector = Unfoldr $ \ step state -> GenericVector.ifoldr (\ index a -> step (index, a)) state vector {-| Binary digits of a non-negative integral number.