packages feed

deferred-folds 0.9.1 → 0.9.2

raw patch · 2 files changed

+29/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DeferredFolds.Unfoldr: setBitIndices :: FiniteBits a => a -> Unfoldr Int
+ DeferredFolds.Unfoldr: unsetBitIndices :: FiniteBits a => a -> Unfoldr Int

Files

deferred-folds.cabal view
@@ -1,5 +1,5 @@ name: deferred-folds-version: 0.9.1+version: 0.9.2 category: Folding synopsis: Abstractions over deferred folds description:
library/DeferredFolds/Defs/Unfoldr.hs view
@@ -215,3 +215,31 @@ zipWithReverseIndex (Unfoldr unfoldr) = Unfoldr $ \ step init -> snd $ unfoldr   (\ a (index, state) -> (succ index, step (index, a) state))   (0, init)++{-|+Indices of set bits.+-}+setBitIndices :: FiniteBits a => a -> Unfoldr Int+setBitIndices a = let+  !size = finiteBitSize a+  in Unfoldr $ \ step state -> let+    loop !index = if index < size+      then if testBit a index+        then step index (loop (succ index))+        else loop (succ index)+      else state+    in loop 0++{-|+Indices of unset bits.+-}+unsetBitIndices :: FiniteBits a => a -> Unfoldr Int+unsetBitIndices a = let+  !size = finiteBitSize a+  in Unfoldr $ \ step state -> let+    loop !index = if index < size+      then if testBit a index+        then loop (succ index)+        else step index (loop (succ index))+      else state+    in loop 0