contiguous 0.6.2.0 → 0.6.3.0
raw patch · 2 files changed
+17/−2 lines, 2 filesdep ~primitivePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: primitive
API changes (from Hackage documentation)
- Data.Primitive.Contiguous: type family MutableSliced arr :: Type -> Type -> Type;
- Data.Primitive.Contiguous.Class: type family UnliftedMut arr = (r :: Type -> Type -> TYPE UnliftedRep) | r -> arr;
+ Data.Primitive.Contiguous: foldrM' :: (Contiguous arr, Element arr a, Monad m) => (a -> b -> m b) -> b -> arr a -> m b
+ Data.Primitive.Contiguous: type Element arr :: Type -> Constraint;
+ Data.Primitive.Contiguous: type Mutable arr = (r :: Type -> Type -> Type) | r -> arr;
+ Data.Primitive.Contiguous: type MutableSliced arr :: Type -> Type -> Type;
+ Data.Primitive.Contiguous: type Sliced arr :: Type -> Type;
+ Data.Primitive.Contiguous.Class: type Element arr :: Type -> Constraint;
+ Data.Primitive.Contiguous.Class: type Mutable arr = (r :: Type -> Type -> Type) | r -> arr;
+ Data.Primitive.Contiguous.Class: type MutableSliced arr :: Type -> Type -> Type;
+ Data.Primitive.Contiguous.Class: type Sliced arr :: Type -> Type;
+ Data.Primitive.Contiguous.Class: type Unlifted arr = (r :: Type -> TYPE UnliftedRep) | r -> arr;
+ Data.Primitive.Contiguous.Class: type UnliftedMut arr = (r :: Type -> Type -> TYPE UnliftedRep) | r -> arr;
Files
- contiguous.cabal +1/−1
- src/Data/Primitive/Contiguous.hs +16/−1
contiguous.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: contiguous-version: 0.6.2.0+version: 0.6.3.0 homepage: https://github.com/andrewthad/contiguous bug-reports: https://github.com/andrewthad/contiguous/issues author: Andrew Martin
src/Data/Primitive/Contiguous.hs view
@@ -148,6 +148,7 @@ , ifoldlMap1' , foldlM' , ifoldlM'+ , foldrM' , asum , all , any@@ -532,10 +533,24 @@ in go 1 (f 0 e0) {-# inline ifoldlMap1' #-} +-- | Strict right monadic fold over the elements of an array.+foldrM' :: (Contiguous arr, Element arr a, Monad m)+ => (a -> b -> m b) -> b -> arr a -> m b+foldrM' f !z0 = \arr ->+ let !sz = size arr+ go !ix !acc1 = if ix >= 0+ then do+ let (# x #) = index# arr ix+ acc2 <- f x acc1+ go (ix - 1) acc2+ else pure acc1+ in go (sz - 1) z0+{-# inline foldrM' #-}+ -- | Strict left monadic fold over the elements of an array. foldlM' :: (Contiguous arr, Element arr a, Monad m) => (b -> a -> m b) -> b -> arr a -> m b-foldlM' f z0 = \arr ->+foldlM' f !z0 = \arr -> let !sz = size arr go !ix !acc1 = if ix < sz then do