{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
module Data.Massiv.Vector (
Vector,
MVector,
slength,
maxLinearSize,
size,
isNull,
isNotNull,
(!?),
(!),
index,
index',
head',
shead',
last',
indexM,
headM,
sheadM,
lastM,
unconsM,
unsnocM,
slice,
slice',
sliceM,
sslice,
sliceAt,
sliceAt',
sliceAtM,
init,
init',
initM,
tail,
tail',
tailM,
take,
take',
takeM,
takeWhile,
stake,
drop,
dropWhile,
drop',
dropM,
sdrop,
empty,
sempty,
singleton,
ssingleton,
cons,
snoc,
A.replicate,
sreplicate,
generate,
sgenerate,
siterate,
siterateN,
sreplicateM,
sgenerateM,
siterateNM,
sunfoldr,
sunfoldrM,
sunfoldrN,
sunfoldrNM,
sunfoldrExactN,
sunfoldrExactNM,
(...),
(..:),
enumFromN,
senumFromN,
enumFromStepN,
senumFromStepN,
sappend,
sconcat,
smap,
simap,
straverse,
sitraverse,
smapM,
smapM_,
simapM,
simapM_,
sforM,
sforM_,
siforM,
siforM_,
szip,
szip3,
szip4,
szip5,
szip6,
szipWith,
szipWith3,
szipWith4,
szipWith5,
szipWith6,
sizipWith,
sizipWith3,
sizipWith4,
sizipWith5,
sizipWith6,
szipWithM,
szipWith3M,
szipWith4M,
szipWith5M,
szipWith6M,
sizipWithM,
sizipWith3M,
sizipWith4M,
sizipWith5M,
sizipWith6M,
szipWithM_,
szipWith3M_,
szipWith4M_,
szipWith5M_,
szipWith6M_,
sizipWithM_,
sizipWith3M_,
sizipWith4M_,
sizipWith5M_,
sizipWith6M_,
sfilter,
sifilter,
sfilterM,
sifilterM,
smapMaybe,
smapMaybeM,
scatMaybes,
simapMaybe,
simapMaybeM,
findIndex,
sfoldl,
sfoldlM,
sfoldlM_,
sifoldl,
sifoldlM,
sifoldlM_,
sfoldl1',
sfoldl1M,
sfoldl1M_,
sor,
sand,
sall,
sany,
ssum,
sproduct,
smaximum',
smaximumM,
sminimum',
sminimumM,
sprescanl,
spostscanl,
spostscanlAcc,
sscanl,
sscanl1,
stoList,
fromList,
sfromList,
sfromListN,
compute,
computeS,
computeIO,
computePrimM,
computeAs,
computeProxy,
computeSource,
computeWithStride,
computeWithStrideAs,
clone,
convert,
convertAs,
convertProxy,
module Data.Massiv.Core,
module Data.Massiv.Array.Delayed,
module Data.Massiv.Array.Manifest,
module Data.Massiv.Array.Mutable,
) where
import Control.Monad hiding (filterM, replicateM)
import Data.Coerce
import Data.Massiv.Array.Delayed
import Data.Massiv.Array.Delayed.Pull
import Data.Massiv.Array.Delayed.Push
import Data.Massiv.Array.Delayed.Stream
import Data.Massiv.Array.Manifest
import Data.Massiv.Array.Manifest.Internal
import Data.Massiv.Array.Manifest.List (fromList)
import Data.Massiv.Array.Mutable
import Data.Massiv.Array.Ops.Construct
import qualified Data.Massiv.Array.Ops.Construct as A (replicate)
import Data.Massiv.Core
import Data.Massiv.Core.Common
import qualified Data.Massiv.Vector.Stream as S
import Data.Massiv.Vector.Unsafe
import Data.Maybe
import Prelude hiding (
drop,
dropWhile,
init,
length,
null,
replicate,
splitAt,
tail,
take,
takeWhile,
)
slength
:: forall r ix e
. Stream r ix e
=> Array r ix e
-> Maybe Sz1
slength :: forall r ix e. Stream r ix e => Array r ix e -> Maybe Sz1
slength Array r ix e
v =
case forall (m :: * -> *) e. Steps m e -> LengthHint
stepsSize (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Array r ix e
v) of
LengthExact Sz1
sz -> forall a. a -> Maybe a
Just Sz1
sz
LengthHint
_ -> forall a. Maybe a
Nothing
{-# INLINE slength #-}
head'
:: forall r e
. (HasCallStack, Source r e)
=> Vector r e
-> e
head' :: forall r e. (HasCallStack, Source r e) => Vector r e -> e
head' = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m e
headM
{-# INLINE head' #-}
headM
:: forall r e m
. (Source r e, MonadThrow m)
=> Vector r e
-> m e
headM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m e
headM Vector r e
v
| forall ix r e. (Index ix, Size r) => Array r ix e -> Int
elemsCount Vector r e
v forall a. Eq a => a -> a -> Bool
== Int
0 = forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v)
| Bool
otherwise = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall r e ix. (Source r e, Index ix) => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v Int
0
{-# INLINE headM #-}
shead'
:: forall r e
. (HasCallStack, Stream r Ix1 e)
=> Vector r e
-> e
shead' :: forall r e. (HasCallStack, Stream r Int e) => Vector r e -> e
shead' = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Stream r Int e, MonadThrow m) =>
Vector r e -> m e
sheadM
{-# INLINE shead' #-}
sheadM
:: forall r e m
. (Stream r Ix1 e, MonadThrow m)
=> Vector r e
-> m e
sheadM :: forall r e (m :: * -> *).
(Stream r Int e, MonadThrow m) =>
Vector r e -> m e
sheadM Vector r e
v =
case forall a. Id a -> a
S.unId (forall (m :: * -> *) a. Monad m => Steps m a -> m (Maybe a)
S.headMaybe (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Vector r e
v)) of
Maybe e
Nothing -> forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (forall ix. Index ix => Sz ix
zeroSz :: Sz1)
Just e
e -> forall (f :: * -> *) a. Applicative f => a -> f a
pure e
e
{-# INLINE sheadM #-}
unconsM
:: forall r e m
. (MonadThrow m, Source r e)
=> Vector r e
-> m (e, Vector r e)
unconsM :: forall r e (m :: * -> *).
(MonadThrow m, Source r e) =>
Vector r e -> m (e, Vector r e)
unconsM Vector r e
arr
| Int
0 forall a. Eq a => a -> a -> Bool
== forall ix. Index ix => Sz ix -> Int
totalElem Sz1
sz = forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException Sz1
sz
| Bool
otherwise = forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall r e ix. (Source r e, Index ix) => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
arr Int
0, forall r e ix.
(Source r e, Index ix) =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
1 (forall ix. ix -> Sz ix
SafeSz (forall ix. Sz ix -> ix
unSz Sz1
sz forall a. Num a => a -> a -> a
- Int
1)) Vector r e
arr)
where
!sz :: Sz1
sz = forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
arr
{-# INLINE unconsM #-}
unsnocM
:: forall r e m
. (MonadThrow m, Source r e)
=> Vector r e
-> m (Vector r e, e)
unsnocM :: forall r e (m :: * -> *).
(MonadThrow m, Source r e) =>
Vector r e -> m (Vector r e, e)
unsnocM Vector r e
arr
| Int
0 forall a. Eq a => a -> a -> Bool
== forall ix. Index ix => Sz ix -> Int
totalElem Sz1
sz = forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException Sz1
sz
| Bool
otherwise = forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall r e ix.
(Source r e, Index ix) =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
0 (forall ix. ix -> Sz ix
SafeSz Int
k) Vector r e
arr, forall r e ix. (Source r e, Index ix) => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
arr Int
k)
where
!sz :: Sz1
sz = forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
arr
!k :: Int
k = forall ix. Sz ix -> ix
unSz Sz1
sz forall a. Num a => a -> a -> a
- Int
1
{-# INLINE unsnocM #-}
last' :: forall r e. (HasCallStack, Source r e) => Vector r e -> e
last' :: forall r e. (HasCallStack, Source r e) => Vector r e -> e
last' = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m e
lastM
{-# INLINE last' #-}
lastM :: forall r e m. (Source r e, MonadThrow m) => Vector r e -> m e
lastM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m e
lastM Vector r e
v
| Int
k forall a. Eq a => a -> a -> Bool
== Int
0 = forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v)
| Bool
otherwise = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall r e ix. (Source r e, Index ix) => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v (Int
k forall a. Num a => a -> a -> a
- Int
1)
where
k :: Int
k = forall ix. Sz ix -> ix
unSz (forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v)
{-# INLINE lastM #-}
slice :: forall r e. Source r e => Ix1 -> Sz1 -> Vector r e -> Vector r e
slice :: forall r e. Source r e => Int -> Sz1 -> Vector r e -> Vector r e
slice !Int
i (Sz Int
k) Vector r e
v = forall r e ix.
(Source r e, Index ix) =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
i' Sz1
newSz Vector r e
v
where
!i' :: Int
i' = forall a. Ord a => a -> a -> a
min Int
n (forall a. Ord a => a -> a -> a
max Int
0 Int
i)
!newSz :: Sz1
newSz = forall ix. ix -> Sz ix
SafeSz (forall a. Ord a => a -> a -> a
min (Int
n forall a. Num a => a -> a -> a
- Int
i') Int
k)
Sz Int
n = forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v
{-# INLINE slice #-}
slice' :: forall r e. (HasCallStack, Source r e) => Ix1 -> Sz1 -> Vector r e -> Vector r e
slice' :: forall r e.
(HasCallStack, Source r e) =>
Int -> Sz1 -> Vector r e -> Vector r e
slice' Int
i Sz1
k = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Int -> Sz1 -> Vector r e -> m (Vector r e)
sliceM Int
i Sz1
k
{-# INLINE slice' #-}
sliceM
:: forall r e m
. (Source r e, MonadThrow m)
=> Ix1
-> Sz1
-> Vector r e
-> m (Vector r e)
sliceM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Int -> Sz1 -> Vector r e -> m (Vector r e)
sliceM Int
i newSz :: Sz1
newSz@(Sz Int
k) Vector r e
v
| Int
i forall a. Ord a => a -> a -> Bool
>= Int
0 Bool -> Bool -> Bool
&& Int
k forall a. Ord a => a -> a -> Bool
<= Int
n forall a. Num a => a -> a -> a
- Int
i = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall r e ix.
(Source r e, Index ix) =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
i Sz1
newSz Vector r e
v
| Bool
otherwise = forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> ix -> Sz ix -> SizeException
SizeSubregionException Sz1
sz Int
i Sz1
newSz
where
sz :: Sz1
sz@(Sz Int
n) = forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v
{-# INLINE sliceM #-}
sslice
:: forall r e
. Stream r Ix1 e
=> Ix1
-> Sz1
-> Vector r e
-> Vector DS e
sslice :: forall r e.
Stream r Int e =>
Int -> Sz1 -> Vector r e -> Vector DS e
sslice !Int
i !Sz1
k = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
Monad m =>
Int -> Sz1 -> Steps m a -> Steps m a
S.slice Int
i Sz1
k forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE sslice #-}
init :: forall r e. Source r e => Vector r e -> Vector r e
init :: forall r e. Source r e => Vector r e -> Vector r e
init Vector r e
v = forall r e ix.
(Source r e, Index ix) =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
0 (forall ix. Index ix => ix -> Sz ix
Sz (coerce :: forall a b. Coercible a b => a -> b
coerce (forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v) forall a. Num a => a -> a -> a
- Int
1)) Vector r e
v
{-# INLINE init #-}
init' :: forall r e. (HasCallStack, Source r e) => Vector r e -> Vector r e
init' :: forall r e. (HasCallStack, Source r e) => Vector r e -> Vector r e
init' = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m (Vector r e)
initM
{-# INLINE init' #-}
initM :: forall r e m. (Source r e, MonadThrow m) => Vector r e -> m (Vector r e)
initM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m (Vector r e)
initM Vector r e
v = do
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (forall ix r e. (Index ix, Size r) => Array r ix e -> Int
elemsCount Vector r e
v forall a. Eq a => a -> a -> Bool
== Int
0) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException forall a b. (a -> b) -> a -> b
$ forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall r e. Source r e => Vector r e -> Vector r e
unsafeInit Vector r e
v
{-# INLINE initM #-}
tail :: forall r e. Source r e => Vector r e -> Vector r e
tail :: forall r e. Source r e => Vector r e -> Vector r e
tail = forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
drop forall ix. Index ix => Sz ix
oneSz
{-# INLINE tail #-}
tail' :: forall r e. (HasCallStack, Source r e) => Vector r e -> Vector r e
tail' :: forall r e. (HasCallStack, Source r e) => Vector r e -> Vector r e
tail' = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m (Vector r e)
tailM
{-# INLINE tail' #-}
tailM :: forall r e m. (Source r e, MonadThrow m) => Vector r e -> m (Vector r e)
tailM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Vector r e -> m (Vector r e)
tailM Vector r e
v = do
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (forall ix r e. (Index ix, Size r) => Array r ix e -> Int
elemsCount Vector r e
v forall a. Eq a => a -> a -> Bool
== Int
0) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException forall a b. (a -> b) -> a -> b
$ forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall r e. Source r e => Vector r e -> Vector r e
unsafeTail Vector r e
v
{-# INLINE tailM #-}
take :: Source r e => Sz1 -> Vector r e -> Vector r e
take :: forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
take Sz1
k = forall a b. (a, b) -> a
fst forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e.
Source r e =>
Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt Sz1
k
{-# INLINE take #-}
takeWhile :: Manifest r e => (e -> Bool) -> Vector r e -> Vector r e
takeWhile :: forall r e. Manifest r e => (e -> Bool) -> Vector r e -> Vector r e
takeWhile e -> Bool
f Vector r e
v = forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
take (Int -> Sz1
go Int
0) Vector r e
v
where
!k :: Int
k = forall ix r e. (Index ix, Size r) => Array r ix e -> Int
elemsCount Vector r e
v
go :: Int -> Sz1
go !Int
i
| Int
i forall a. Ord a => a -> a -> Bool
< Int
k Bool -> Bool -> Bool
&& e -> Bool
f (forall r e ix. (Source r e, Index ix) => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v Int
i) = Int -> Sz1
go (Int
i forall a. Num a => a -> a -> a
+ Int
1)
| Bool
otherwise = forall ix. ix -> Sz ix
SafeSz Int
i
{-# INLINE takeWhile #-}
take' :: forall r e. (HasCallStack, Source r e) => Sz1 -> Vector r e -> Vector r e
take' :: forall r e.
(HasCallStack, Source r e) =>
Sz1 -> Vector r e -> Vector r e
take' Sz1
k = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
takeM Sz1
k
{-# INLINE take' #-}
takeM :: forall r e m. (Source r e, MonadThrow m) => Sz1 -> Vector r e -> m (Vector r e)
takeM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
takeM Sz1
k Vector r e
v = do
let sz :: Sz1
sz = forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Sz1
k forall a. Ord a => a -> a -> Bool
> Sz1
sz) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> ix -> Sz ix -> SizeException
SizeSubregionException Sz1
sz Int
0 Sz1
k
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
unsafeTake Sz1
k Vector r e
v
{-# INLINE takeM #-}
stake :: forall r e. Stream r Ix1 e => Sz1 -> Vector r e -> Vector DS e
stake :: forall r e. Stream r Int e => Sz1 -> Vector r e -> Vector DS e
stake Sz1
n = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. Monad m => Sz1 -> Steps m a -> Steps m a
S.take Sz1
n forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE stake #-}
drop :: forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
drop :: forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
drop Sz1
k = forall a b. (a, b) -> b
snd forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e.
Source r e =>
Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt Sz1
k
{-# INLINE drop #-}
dropWhile :: forall r e. Manifest r e => (e -> Bool) -> Vector r e -> Vector r e
dropWhile :: forall r e. Manifest r e => (e -> Bool) -> Vector r e -> Vector r e
dropWhile e -> Bool
f Vector r e
v = forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
drop (Int -> Sz1
go Int
0) Vector r e
v
where
!k :: Int
k = forall ix r e. (Index ix, Size r) => Array r ix e -> Int
elemsCount Vector r e
v
go :: Int -> Sz1
go !Int
i
| Int
i forall a. Ord a => a -> a -> Bool
< Int
k Bool -> Bool -> Bool
&& e -> Bool
f (forall r e ix. (Source r e, Index ix) => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v Int
i) = Int -> Sz1
go (Int
i forall a. Num a => a -> a -> a
+ Int
1)
| Bool
otherwise = forall ix. ix -> Sz ix
SafeSz Int
i
{-# INLINE dropWhile #-}
sdrop :: forall r e. Stream r Ix1 e => Sz1 -> Vector r e -> Vector DS e
sdrop :: forall r e. Stream r Int e => Sz1 -> Vector r e -> Vector DS e
sdrop Sz1
n = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. Monad m => Sz1 -> Steps m a -> Steps m a
S.drop Sz1
n forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE sdrop #-}
drop' :: forall r e. (HasCallStack, Source r e) => Sz1 -> Vector r e -> Vector r e
drop' :: forall r e.
(HasCallStack, Source r e) =>
Sz1 -> Vector r e -> Vector r e
drop' Sz1
k = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
dropM Sz1
k
{-# INLINE drop' #-}
dropM :: forall r e m. (Source r e, MonadThrow m) => Sz1 -> Vector r e -> m (Vector r e)
dropM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
dropM k :: Sz1
k@(Sz Int
d) Vector r e
v = do
let sz :: Sz1
sz@(Sz Int
n) = forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Sz1
k forall a. Ord a => a -> a -> Bool
> Sz1
sz) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> ix -> Sz ix -> SizeException
SizeSubregionException Sz1
sz Int
d (forall ix. ix -> Sz ix
SafeSz (Int
n forall a. Num a => a -> a -> a
- Int
d))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall r e ix.
(Source r e, Index ix) =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
d (forall ix. ix -> Sz ix
SafeSz (Int
n forall a. Num a => a -> a -> a
- Int
d)) Vector r e
v
{-# INLINE dropM #-}
sliceAt :: forall r e. Source r e => Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt :: forall r e.
Source r e =>
Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt (Sz Int
k) Vector r e
v = (forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
unsafeTake Sz1
d Vector r e
v, forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
unsafeDrop Sz1
d Vector r e
v)
where
!n :: Int
n = coerce :: forall a b. Coercible a b => a -> b
coerce (forall r ix e. Size r => Array r ix e -> Sz ix
size Vector r e
v)
!d :: Sz1
d = forall ix. ix -> Sz ix
SafeSz (forall a. Ord a => a -> a -> a
min Int
k Int
n)
{-# INLINE sliceAt #-}
sliceAt' :: (HasCallStack, Source r e) => Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt' :: forall r e.
(HasCallStack, Source r e) =>
Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt' Sz1
k = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e, Vector r e)
sliceAtM Sz1
k
{-# INLINE sliceAt' #-}
sliceAtM :: forall r e m. (Source r e, MonadThrow m) => Sz1 -> Vector r e -> m (Vector r e, Vector r e)
sliceAtM :: forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e, Vector r e)
sliceAtM Sz1
k Vector r e
v = do
Vector r e
l <- forall r e (m :: * -> *).
(Source r e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
takeM Sz1
k Vector r e
v
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e
l, forall r e. Source r e => Sz1 -> Vector r e -> Vector r e
unsafeDrop Sz1
k Vector r e
v)
{-# INLINE sliceAtM #-}
sempty :: Vector DS e
sempty :: forall e. Vector DS e
sempty = forall e. Steps Id e -> Vector DS e
DSArray forall (m :: * -> *) e. Monad m => Steps m e
S.empty
{-# INLINE sempty #-}
ssingleton :: e -> Vector DS e
ssingleton :: forall e. e -> Vector DS e
ssingleton = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => e -> Steps m e
S.singleton
{-# INLINE ssingleton #-}
cons :: forall r e. (Size r, Load r Ix1 e) => e -> Vector r e -> Vector DL e
cons :: forall r e.
(Size r, Load r Int e) =>
e -> Vector r e -> Vector DL e
cons e
e Vector r e
v =
let dv :: Array DL Int e
dv = forall r ix e.
(Size r, Load r ix e) =>
Array r ix e -> Array DL ix e
toLoadArray Vector r e
v
load :: Scheduler s ()
-> Int
-> (Int -> e -> ST s ())
-> (Int -> Sz1 -> e -> ST s ())
-> ST s ()
load Scheduler s ()
scheduler Int
startAt Int -> e -> ST s ()
uWrite Int -> Sz1 -> e -> ST s ()
uSet =
Int -> e -> ST s ()
uWrite Int
startAt e
e forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> forall ix e. Array DL ix e -> Loader e
dlLoad Array DL Int e
dv Scheduler s ()
scheduler (Int
startAt forall a. Num a => a -> a -> a
+ Int
1) Int -> e -> ST s ()
uWrite Int -> Sz1 -> e -> ST s ()
uSet
{-# INLINE load #-}
in Array DL Int e
dv{dlSize :: Sz1
dlSize = forall ix. ix -> Sz ix
SafeSz (Int
1 forall a. Num a => a -> a -> a
+ forall ix. Sz ix -> ix
unSz (forall ix e. Array DL ix e -> Sz ix
dlSize Array DL Int e
dv)), dlLoad :: Loader e
dlLoad = Loader e
load}
{-# INLINE cons #-}
snoc :: forall r e. (Size r, Load r Ix1 e) => Vector r e -> e -> Vector DL e
snoc :: forall r e.
(Size r, Load r Int e) =>
Vector r e -> e -> Vector DL e
snoc Vector r e
v e
e =
let dv :: Array DL Int e
dv = forall r ix e.
(Size r, Load r ix e) =>
Array r ix e -> Array DL ix e
toLoadArray Vector r e
v
!k :: Int
k = forall ix. Sz ix -> ix
unSz (forall r ix e. Size r => Array r ix e -> Sz ix
size Array DL Int e
dv)
load :: Scheduler s ()
-> Int
-> (Int -> e -> ST s ())
-> (Int -> Sz1 -> e -> ST s ())
-> ST s ()
load Scheduler s ()
scheduler Int
startAt Int -> e -> ST s ()
uWrite Int -> Sz1 -> e -> ST s ()
uSet =
forall ix e. Array DL ix e -> Loader e
dlLoad Array DL Int e
dv Scheduler s ()
scheduler Int
startAt Int -> e -> ST s ()
uWrite Int -> Sz1 -> e -> ST s ()
uSet forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Int -> e -> ST s ()
uWrite (Int
k forall a. Num a => a -> a -> a
+ Int
startAt) e
e
{-# INLINE load #-}
in Array DL Int e
dv{dlSize :: Sz1
dlSize = forall ix. ix -> Sz ix
SafeSz (Int
1 forall a. Num a => a -> a -> a
+ Int
k), dlLoad :: Loader e
dlLoad = Loader e
load}
{-# INLINE snoc #-}
sreplicate :: Sz1 -> e -> Vector DS e
sreplicate :: forall e. Sz1 -> e -> Vector DS e
sreplicate Sz1
n = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. Monad m => Sz1 -> a -> Steps m a
S.replicate Sz1
n
{-# INLINE sreplicate #-}
generate :: Comp -> Sz1 -> (Ix1 -> e) -> Vector D e
generate :: forall e. Comp -> Sz1 -> (Int -> e) -> Vector D e
generate = forall r ix e.
Load r ix e =>
Comp -> Sz ix -> (Int -> e) -> Array r ix e
makeArrayLinear
{-# INLINE generate #-}
sgenerate :: Sz1 -> (Ix1 -> e) -> Vector DS e
sgenerate :: forall e. Sz1 -> (Int -> e) -> Vector DS e
sgenerate Sz1
n = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Sz1 -> (Int -> e) -> Steps m e
S.generate Sz1
n
{-# INLINE sgenerate #-}
siterate :: (e -> e) -> e -> Vector DS e
siterate :: forall e. (e -> e) -> e -> Vector DS e
siterate e -> e
f = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s e.
Monad m =>
(s -> Maybe (e, s)) -> s -> Steps m e
S.unfoldr (\e
a -> forall a. a -> Maybe a
Just (e
a, e -> e
f e
a))
{-# INLINE siterate #-}
siterateN :: Sz1 -> (e -> e) -> e -> Vector DS e
siterateN :: forall e. Sz1 -> (e -> e) -> e -> Vector DS e
siterateN Sz1
n e -> e
f e
a = forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
Monad m =>
Sz1 -> (a -> a) -> a -> Steps m a
S.iterateN Sz1
n e -> e
f e
a
{-# INLINE siterateN #-}
sreplicateM :: forall e m. Monad m => Sz1 -> m e -> m (Vector DS e)
sreplicateM :: forall e (m :: * -> *). Monad m => Sz1 -> m e -> m (Vector DS e)
sreplicateM Sz1
n m e
f = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. Monad m => Sz1 -> m a -> Steps m a
S.replicateM Sz1
n m e
f
{-# INLINE sreplicateM #-}
sgenerateM :: forall e m. Monad m => Sz1 -> (Ix1 -> m e) -> m (Vector DS e)
sgenerateM :: forall e (m :: * -> *).
Monad m =>
Sz1 -> (Int -> m e) -> m (Vector DS e)
sgenerateM Sz1
n Int -> m e
f = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. Monad m => Sz1 -> (Int -> m a) -> Steps m a
S.generateM Sz1
n Int -> m e
f
{-# INLINE sgenerateM #-}
siterateNM :: forall e m. Monad m => Sz1 -> (e -> m e) -> e -> m (Vector DS e)
siterateNM :: forall e (m :: * -> *).
Monad m =>
Sz1 -> (e -> m e) -> e -> m (Vector DS e)
siterateNM Sz1
n e -> m e
f e
a = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a.
Monad m =>
Sz1 -> (a -> m a) -> a -> Steps m a
S.iterateNM Sz1
n e -> m e
f e
a
{-# INLINE siterateNM #-}
sunfoldr :: forall e s. (s -> Maybe (e, s)) -> s -> Vector DS e
sunfoldr :: forall e s. (s -> Maybe (e, s)) -> s -> Vector DS e
sunfoldr s -> Maybe (e, s)
f = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s e.
Monad m =>
(s -> Maybe (e, s)) -> s -> Steps m e
S.unfoldr s -> Maybe (e, s)
f
{-# INLINE sunfoldr #-}
sunfoldrN
:: forall e s
. Sz1
-> (s -> Maybe (e, s))
-> s
-> Vector DS e
sunfoldrN :: forall e s. Sz1 -> (s -> Maybe (e, s)) -> s -> Vector DS e
sunfoldrN Sz1
n s -> Maybe (e, s)
f = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s e.
Monad m =>
Sz1 -> (s -> Maybe (e, s)) -> s -> Steps m e
S.unfoldrN Sz1
n s -> Maybe (e, s)
f
{-# INLINE sunfoldrN #-}
sunfoldrM :: forall e s m. Monad m => (s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrM :: forall e s (m :: * -> *).
Monad m =>
(s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrM s -> m (Maybe (e, s))
f = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s e.
Monad m =>
(s -> m (Maybe (e, s))) -> s -> Steps m e
S.unfoldrM s -> m (Maybe (e, s))
f
{-# INLINE sunfoldrM #-}
sunfoldrNM :: forall e s m. Monad m => Sz1 -> (s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrNM :: forall e s (m :: * -> *).
Monad m =>
Sz1 -> (s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrNM (Sz Int
n) s -> m (Maybe (e, s))
f = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s e.
Monad m =>
Int -> (s -> m (Maybe (e, s))) -> s -> Steps m e
S.unfoldrNM Int
n s -> m (Maybe (e, s))
f
{-# INLINE sunfoldrNM #-}
sunfoldrExactN :: forall e s. Sz1 -> (s -> (e, s)) -> s -> Vector DS e
sunfoldrExactN :: forall e s. Sz1 -> (s -> (e, s)) -> s -> Vector DS e
sunfoldrExactN Sz1
n s -> (e, s)
f = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s a.
Monad m =>
Sz1 -> (s -> (a, s)) -> s -> Steps m a
S.unfoldrExactN Sz1
n s -> (e, s)
f
{-# INLINE sunfoldrExactN #-}
sunfoldrExactNM :: forall e s m. Monad m => Sz1 -> (s -> m (e, s)) -> s -> m (Vector DS e)
sunfoldrExactNM :: forall e s (m :: * -> *).
Monad m =>
Sz1 -> (s -> m (e, s)) -> s -> m (Vector DS e)
sunfoldrExactNM Sz1
n s -> m (e, s)
f = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) s a.
Monad m =>
Sz1 -> (s -> m (a, s)) -> s -> Steps m a
S.unfoldrExactNM Sz1
n s -> m (e, s)
f
{-# INLINE sunfoldrExactNM #-}
senumFromN
:: Num e
=> e
-> Sz1
-> Vector DS e
senumFromN :: forall e. Num e => e -> Sz1 -> Vector DS e
senumFromN e
x Sz1
n = forall e. Steps Id e -> Vector DS e
DSArray forall a b. (a -> b) -> a -> b
$ forall a (m :: * -> *).
(Num a, Monad m) =>
a -> a -> Sz1 -> Steps m a
S.enumFromStepN e
x e
1 Sz1
n
{-# INLINE senumFromN #-}
senumFromStepN
:: Num e
=> e
-> e
-> Sz1
-> Vector DS e
senumFromStepN :: forall e. Num e => e -> e -> Sz1 -> Vector DS e
senumFromStepN e
x e
step Sz1
n = forall e. Steps Id e -> Vector DS e
DSArray forall a b. (a -> b) -> a -> b
$ forall a (m :: * -> *).
(Num a, Monad m) =>
a -> a -> Sz1 -> Steps m a
S.enumFromStepN e
x e
step Sz1
n
{-# INLINE senumFromStepN #-}
sappend
:: forall r1 r2 e
. (Stream r1 Ix1 e, Stream r2 Ix1 e)
=> Vector r1 e
-> Vector r2 e
-> Vector DS e
sappend :: forall r1 r2 e.
(Stream r1 Int e, Stream r2 Int e) =>
Vector r1 e -> Vector r2 e -> Vector DS e
sappend Vector r1 e
a1 Vector r2 e
a2 = forall e. Steps Id e -> Vector DS e
fromSteps (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Vector r1 e
a1 forall (m :: * -> *) e.
Monad m =>
Steps m e -> Steps m e -> Steps m e
`S.append` forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Vector r2 e
a2)
{-# INLINE sappend #-}
sconcat :: forall r e. Stream r Ix1 e => [Vector r e] -> Vector DS e
sconcat :: forall r e. Stream r Int e => [Vector r e] -> Vector DS e
sconcat = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sconcat #-}
sfromList :: [e] -> Vector DS e
sfromList :: forall e. [e] -> Vector DS e
sfromList = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => [e] -> Steps m e
S.fromList
{-# INLINE sfromList #-}
sfromListN :: Sz1 -> [e] -> Vector DS e
sfromListN :: forall e. Sz1 -> [e] -> Vector DS e
sfromListN (Sz Int
n) = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Int -> [e] -> Steps m e
S.fromListN Int
n
{-# INLINE sfromListN #-}
stoList :: forall r ix e. Stream r ix e => Array r ix e -> [e]
stoList :: forall r ix e. Stream r ix e => Array r ix e -> [e]
stoList = forall e. Steps Id e -> [e]
S.toList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE stoList #-}
sfilter :: forall r ix e. S.Stream r ix e => (e -> Bool) -> Array r ix e -> Vector DS e
sfilter :: forall r ix e.
Stream r ix e =>
(e -> Bool) -> Array r ix e -> Vector DS e
sfilter e -> Bool
f = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
Monad m =>
(a -> Bool) -> Steps m a -> Steps m a
S.filter e -> Bool
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE sfilter #-}
sifilter :: forall r ix e. Stream r ix e => (ix -> e -> Bool) -> Array r ix e -> Vector DS e
sifilter :: forall r ix e.
Stream r ix e =>
(ix -> e -> Bool) -> Array r ix e -> Vector DS e
sifilter ix -> e -> Bool
f =
forall r ix a b.
Stream r ix a =>
(ix -> a -> Maybe b) -> Array r ix a -> Vector DS b
simapMaybe forall a b. (a -> b) -> a -> b
$ \ix
ix e
e ->
if ix -> e -> Bool
f ix
ix e
e
then forall a. a -> Maybe a
Just e
e
else forall a. Maybe a
Nothing
{-# INLINE sifilter #-}
sfilterM
:: forall r ix e f
. (S.Stream r ix e, Applicative f)
=> (e -> f Bool)
-> Array r ix e
-> f (Vector DS e)
sfilterM :: forall r ix e (f :: * -> *).
(Stream r ix e, Applicative f) =>
(e -> f Bool) -> Array r ix e -> f (Vector DS e)
sfilterM e -> f Bool
f Array r ix e
arr = forall e. Steps Id e -> Vector DS e
DSArray forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *) (f :: * -> *) e.
(Monad m, Applicative f) =>
(e -> f Bool) -> Steps Id e -> f (Steps m e)
S.filterA e -> f Bool
f (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Array r ix e
arr)
{-# INLINE sfilterM #-}
sifilterM
:: forall r ix e f
. (Stream r ix e, Applicative f)
=> (ix -> e -> f Bool)
-> Array r ix e
-> f (Vector DS e)
sifilterM :: forall r ix e (f :: * -> *).
(Stream r ix e, Applicative f) =>
(ix -> e -> f Bool) -> Array r ix e -> f (Vector DS e)
sifilterM ix -> e -> f Bool
f =
forall r ix a b (f :: * -> *).
(Stream r ix a, Applicative f) =>
(ix -> a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
simapMaybeM forall a b. (a -> b) -> a -> b
$ \ix
ix e
e ->
( \Bool
p ->
if Bool
p
then forall a. a -> Maybe a
Just e
e
else forall a. Maybe a
Nothing
)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ix -> e -> f Bool
f ix
ix e
e
{-# INLINE sifilterM #-}
smapMaybe :: forall r ix a b. S.Stream r ix a => (a -> Maybe b) -> Array r ix a -> Vector DS b
smapMaybe :: forall r ix a b.
Stream r ix a =>
(a -> Maybe b) -> Array r ix a -> Vector DS b
smapMaybe a -> Maybe b
f = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a e.
Monad m =>
(a -> Maybe e) -> Steps m a -> Steps m e
S.mapMaybe a -> Maybe b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapMaybe #-}
simapMaybe
:: forall r ix a b
. Stream r ix a
=> (ix -> a -> Maybe b)
-> Array r ix a
-> Vector DS b
simapMaybe :: forall r ix a b.
Stream r ix a =>
(ix -> a -> Maybe b) -> Array r ix a -> Vector DS b
simapMaybe ix -> a -> Maybe b
f = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a e.
Monad m =>
(a -> Maybe e) -> Steps m a -> Steps m e
S.mapMaybe (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> Maybe b
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE simapMaybe #-}
simapMaybeM
:: forall r ix a b f
. (Stream r ix a, Applicative f)
=> (ix -> a -> f (Maybe b))
-> Array r ix a
-> f (Vector DS b)
simapMaybeM :: forall r ix a b (f :: * -> *).
(Stream r ix a, Applicative f) =>
(ix -> a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
simapMaybeM ix -> a -> f (Maybe b)
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (f :: * -> *) a e.
(Monad m, Applicative f) =>
(a -> f (Maybe e)) -> Steps Id a -> f (Steps m e)
S.mapMaybeA (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> f (Maybe b)
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE simapMaybeM #-}
scatMaybes :: forall r ix a. S.Stream r ix (Maybe a) => Array r ix (Maybe a) -> Vector DS a
scatMaybes :: forall r ix a.
Stream r ix (Maybe a) =>
Array r ix (Maybe a) -> Vector DS a
scatMaybes = forall r ix a b.
Stream r ix a =>
(a -> Maybe b) -> Array r ix a -> Vector DS b
smapMaybe forall a. a -> a
id
{-# INLINE scatMaybes #-}
smapMaybeM
:: forall r ix a b f
. (S.Stream r ix a, Applicative f)
=> (a -> f (Maybe b))
-> Array r ix a
-> f (Vector DS b)
smapMaybeM :: forall r ix a b (f :: * -> *).
(Stream r ix a, Applicative f) =>
(a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
smapMaybeM a -> f (Maybe b)
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (f :: * -> *) a e.
(Monad m, Applicative f) =>
(a -> f (Maybe e)) -> Steps Id a -> f (Steps m e)
S.mapMaybeA a -> f (Maybe b)
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapMaybeM #-}
smap
:: forall r ix a b
. S.Stream r ix a
=> (a -> b)
-> Array r ix a
-> Vector DS b
smap :: forall r ix a b.
Stream r ix a =>
(a -> b) -> Array r ix a -> Vector DS b
smap a -> b
f = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map a -> b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smap #-}
simap
:: forall r ix a b
. S.Stream r ix a
=> (ix -> a -> b)
-> Array r ix a
-> Vector DS b
simap :: forall r ix a b.
Stream r ix a =>
(ix -> a -> b) -> Array r ix a -> Vector DS b
simap ix -> a -> b
f = forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> b
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE simap #-}
straverse
:: forall r ix a b f
. (S.Stream r ix a, Applicative f)
=> (a -> f b)
-> Array r ix a
-> f (Vector DS b)
straverse :: forall r ix a b (f :: * -> *).
(Stream r ix a, Applicative f) =>
(a -> f b) -> Array r ix a -> f (Vector DS b)
straverse a -> f b
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (f :: * -> *) e a.
(Monad m, Applicative f) =>
(e -> f a) -> Steps Id e -> f (Steps m a)
S.traverse a -> f b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE straverse #-}
sitraverse
:: forall r ix a b f
. (S.Stream r ix a, Applicative f)
=> (ix -> a -> f b)
-> Array r ix a
-> f (Vector DS b)
sitraverse :: forall r ix a b (f :: * -> *).
(Stream r ix a, Applicative f) =>
(ix -> a -> f b) -> Array r ix a -> f (Vector DS b)
sitraverse ix -> a -> f b
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall e. Steps Id e -> Vector DS e
fromSteps forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) (f :: * -> *) e a.
(Monad m, Applicative f) =>
(e -> f a) -> Steps Id e -> f (Steps m a)
S.traverse (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> f b
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE sitraverse #-}
smapM
:: forall r ix a b m
. (S.Stream r ix a, Monad m)
=> (a -> m b)
-> Array r ix a
-> m (Vector DS b)
smapM :: forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(a -> m b) -> Array r ix a -> m (Vector DS b)
smapM a -> m b
f = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> Steps m a
S.mapM a -> m b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapM #-}
simapM
:: forall r ix a b m
. (S.Stream r ix a, Monad m)
=> (ix -> a -> m b)
-> Array r ix a
-> m (Vector DS b)
simapM :: forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(ix -> a -> m b) -> Array r ix a -> m (Vector DS b)
simapM ix -> a -> m b
f = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> Steps m a
S.mapM (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> m b
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE simapM #-}
smapM_
:: forall r ix a b m
. (S.Stream r ix a, Monad m)
=> (a -> m b)
-> Array r ix a
-> m ()
smapM_ :: forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(a -> m b) -> Array r ix a -> m ()
smapM_ a -> m b
f = forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> m ()
S.mapM_ a -> m b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapM_ #-}
simapM_
:: forall r ix a b m
. (S.Stream r ix a, Monad m)
=> (ix -> a -> m b)
-> Array r ix a
-> m ()
simapM_ :: forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(ix -> a -> m b) -> Array r ix a -> m ()
simapM_ ix -> a -> m b
f = forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> m ()
S.mapM_ (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> m b
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE simapM_ #-}
sforM
:: forall r ix a b m
. (S.Stream r ix a, Monad m)
=> Array r ix a
-> (a -> m b)
-> m (Vector DS b)
sforM :: forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
Array r ix a -> (a -> m b) -> m (Vector DS b)
sforM = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(a -> m b) -> Array r ix a -> m (Vector DS b)
smapM
{-# INLINE sforM #-}
siforM
:: forall r ix a b m
. (S.Stream r ix a, Monad m)
=> Array r ix a
-> (ix -> a -> m b)
-> m (Vector DS b)
siforM :: forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
Array r ix a -> (ix -> a -> m b) -> m (Vector DS b)
siforM = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(ix -> a -> m b) -> Array r ix a -> m (Vector DS b)
simapM
{-# INLINE siforM #-}
sforM_ :: (S.Stream r ix a, Monad m) => Array r ix a -> (a -> m b) -> m ()
sforM_ :: forall r ix a (m :: * -> *) b.
(Stream r ix a, Monad m) =>
Array r ix a -> (a -> m b) -> m ()
sforM_ = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(a -> m b) -> Array r ix a -> m ()
smapM_
{-# INLINE sforM_ #-}
siforM_
:: forall r ix a b m
. (S.Stream r ix a, Monad m)
=> Array r ix a
-> (ix -> a -> m b)
-> m ()
siforM_ :: forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
Array r ix a -> (ix -> a -> m b) -> m ()
siforM_ = forall a b c. (a -> b -> c) -> b -> a -> c
flip forall r ix a b (m :: * -> *).
(Stream r ix a, Monad m) =>
(ix -> a -> m b) -> Array r ix a -> m ()
simapM_
{-# INLINE siforM_ #-}
szip
:: forall ra rb a b
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b)
=> Vector ra a
-> Vector rb b
-> Vector DS (a, b)
szip :: forall ra rb a b.
(Stream ra Int a, Stream rb Int b) =>
Vector ra a -> Vector rb b -> Vector DS (a, b)
szip = forall ra rb a b c.
(Stream ra Int a, Stream rb Int b) =>
(a -> b -> c) -> Vector ra a -> Vector rb b -> Vector DS c
szipWith (,)
{-# INLINE szip #-}
szip3
:: forall ra rb rc a b c
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c)
=> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector DS (a, b, c)
szip3 :: forall ra rb rc a b c.
(Stream ra Int a, Stream rb Int b, Stream rc Int c) =>
Vector ra a -> Vector rb b -> Vector rc c -> Vector DS (a, b, c)
szip3 = forall ra rb rc a b c d.
(Stream ra Int a, Stream rb Int b, Stream rc Int c) =>
(a -> b -> c -> d)
-> Vector ra a -> Vector rb b -> Vector rc c -> Vector DS d
szipWith3 (,,)
{-# INLINE szip3 #-}
szip4
:: forall ra rb rc rd a b c d
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d)
=> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS (a, b, c, d)
szip4 :: forall ra rb rc rd a b c d.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d) =>
Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS (a, b, c, d)
szip4 = forall ra rb rc rd a b c d e.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d) =>
(a -> b -> c -> d -> e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS e
szipWith4 (,,,)
{-# INLINE szip4 #-}
szip5
:: forall ra rb rc rd re a b c d e
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d, S.Stream re Ix1 e)
=> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS (a, b, c, d, e)
szip5 :: forall ra rb rc rd re a b c d e.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e) =>
Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS (a, b, c, d, e)
szip5 = forall ra rb rc rd re a b c d e f.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e) =>
(a -> b -> c -> d -> e -> f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS f
szipWith5 (,,,,)
{-# INLINE szip5 #-}
szip6
:: forall ra rb rc rd re rf a b c d e f
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, S.Stream rf Ix1 f
)
=> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> Vector DS (a, b, c, d, e, f)
szip6 :: forall ra rb rc rd re rf a b c d e f.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f) =>
Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> Vector DS (a, b, c, d, e, f)
szip6 = forall ra rb rc rd re rf a b c d e f g.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f) =>
(a -> b -> c -> d -> e -> f -> g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> Vector DS g
szipWith6 (,,,,,)
{-# INLINE szip6 #-}
szipWith
:: forall ra rb a b c
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b)
=> (a -> b -> c)
-> Vector ra a
-> Vector rb b
-> Vector DS c
szipWith :: forall ra rb a b c.
(Stream ra Int a, Stream rb Int b) =>
(a -> b -> c) -> Vector ra a -> Vector rb b -> Vector DS c
szipWith a -> b -> c
f Vector ra a
v1 Vector rb b
v2 = forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b e.
Monad m =>
(a -> b -> e) -> Steps m a -> Steps m b -> Steps m e
S.zipWith a -> b -> c
f (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
{-# INLINE szipWith #-}
szipWith3
:: forall ra rb rc a b c d
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c)
=> (a -> b -> c -> d)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector DS d
szipWith3 :: forall ra rb rc a b c d.
(Stream ra Int a, Stream rb Int b, Stream rc Int c) =>
(a -> b -> c -> d)
-> Vector ra a -> Vector rb b -> Vector rc c -> Vector DS d
szipWith3 a -> b -> c -> d
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 = forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> d)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d
S.zipWith3 a -> b -> c -> d
f (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
{-# INLINE szipWith3 #-}
szipWith4
:: forall ra rb rc rd a b c d e
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d)
=> (a -> b -> c -> d -> e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS e
szipWith4 :: forall ra rb rc rd a b c d e.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d) =>
(a -> b -> c -> d -> e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS e
szipWith4 a -> b -> c -> d -> e
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 =
forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> Steps m e
S.zipWith4 a -> b -> c -> d -> e
f (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
{-# INLINE szipWith4 #-}
szipWith5
:: forall ra rb rc rd re a b c d e f
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d, S.Stream re Ix1 e)
=> (a -> b -> c -> d -> e -> f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS f
szipWith5 :: forall ra rb rc rd re a b c d e f.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e) =>
(a -> b -> c -> d -> e -> f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS f
szipWith5 a -> b -> c -> d -> e -> f
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 =
forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> f)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
S.zipWith5 a -> b -> c -> d -> e -> f
f (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
{-# INLINE szipWith5 #-}
szipWith6
:: forall ra rb rc rd re rf a b c d e f g
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, S.Stream rf Ix1 f
)
=> (a -> b -> c -> d -> e -> f -> g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> Vector DS g
szipWith6 :: forall ra rb rc rd re rf a b c d e f g.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f) =>
(a -> b -> c -> d -> e -> f -> g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> Vector DS g
szipWith6 a -> b -> c -> d -> e -> f -> g
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 Vector rf f
v6 =
forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> g)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> Steps m g
S.zipWith6
a -> b -> c -> d -> e -> f -> g
f
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rf f
v6)
{-# INLINE szipWith6 #-}
sizipWith
:: forall ra rb a b c
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b)
=> (Ix1 -> a -> b -> c)
-> Vector ra a
-> Vector rb b
-> Vector DS c
sizipWith :: forall ra rb a b c.
(Stream ra Int a, Stream rb Int b) =>
(Int -> a -> b -> c) -> Vector ra a -> Vector rb b -> Vector DS c
sizipWith Int -> a -> b -> c
f Vector ra a
v1 Vector rb b
v2 = forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b e.
Monad m =>
(a -> b -> e) -> Steps m a -> Steps m b -> Steps m e
S.zipWith (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c
f) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
{-# INLINE sizipWith #-}
sizipWith3
:: forall ra rb rc a b c d
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c)
=> (Ix1 -> a -> b -> c -> d)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector DS d
sizipWith3 :: forall ra rb rc a b c d.
(Stream ra Int a, Stream rb Int b, Stream rc Int c) =>
(Int -> a -> b -> c -> d)
-> Vector ra a -> Vector rb b -> Vector rc c -> Vector DS d
sizipWith3 Int -> a -> b -> c -> d
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 =
forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> d)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d
S.zipWith3 (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d
f) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
{-# INLINE sizipWith3 #-}
sizipWith4
:: forall ra rb rc rd a b c d e
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d)
=> (Ix1 -> a -> b -> c -> d -> e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS e
sizipWith4 :: forall ra rb rc rd a b c d e.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d) =>
(Int -> a -> b -> c -> d -> e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS e
sizipWith4 Int -> a -> b -> c -> d -> e
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 =
forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> Steps m e
S.zipWith4 (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e
f) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3) (forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
{-# INLINE sizipWith4 #-}
sizipWith5
:: forall ra rb rc rd re a b c d e f
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d, S.Stream re Ix1 e)
=> (Ix1 -> a -> b -> c -> d -> e -> f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS f
sizipWith5 :: forall ra rb rc rd re a b c d e f.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e) =>
(Int -> a -> b -> c -> d -> e -> f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS f
sizipWith5 Int -> a -> b -> c -> d -> e -> f
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 =
forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> f)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
S.zipWith5
(forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f
f)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
{-# INLINE sizipWith5 #-}
sizipWith6
:: forall ra rb rc rd re rf a b c d e f g
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, S.Stream rf Ix1 f
)
=> (Ix1 -> a -> b -> c -> d -> e -> f -> g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> Vector DS g
sizipWith6 :: forall ra rb rc rd re rf a b c d e f g.
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f) =>
(Int -> a -> b -> c -> d -> e -> f -> g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> Vector DS g
sizipWith6 Int -> a -> b -> c -> d -> e -> f -> g
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 Vector rf f
v6 =
forall e. Steps Id e -> Vector DS e
fromSteps forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> g)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> Steps m g
S.zipWith6
(forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f -> g
f)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
(forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rf f
v6)
{-# INLINE sizipWith6 #-}
szipWithM
:: forall ra rb a b c m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, Monad m)
=> (a -> b -> m c)
-> Vector ra a
-> Vector rb b
-> m (Vector DS c)
szipWithM :: forall ra rb a b c (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Monad m) =>
(a -> b -> m c) -> Vector ra a -> Vector rb b -> m (Vector DS c)
szipWithM a -> b -> m c
f Vector ra a
v1 Vector rb b
v2 = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Steps m a -> Steps m b -> Steps m c
S.zipWithM a -> b -> m c
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
{-# INLINE szipWithM #-}
szipWith3M
:: forall ra rb rc a b c d m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, Monad m)
=> (a -> b -> c -> m d)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> m (Vector DS d)
szipWith3M :: forall ra rb rc a b c d (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c, Monad m) =>
(a -> b -> c -> m d)
-> Vector ra a -> Vector rb b -> Vector rc c -> m (Vector DS d)
szipWith3M a -> b -> c -> m d
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> m d)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d
S.zipWith3M a -> b -> c -> m d
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
{-# INLINE szipWith3M #-}
szipWith4M
:: forall ra rb rc rd a b c d e m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d, Monad m)
=> (a -> b -> c -> d -> m e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> m (Vector DS e)
szipWith4M :: forall ra rb rc rd a b c d e (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Monad m) =>
(a -> b -> c -> d -> m e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> m (Vector DS e)
szipWith4M a -> b -> c -> d -> m e
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 =
forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> m e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> Steps m e
S.zipWith4M a -> b -> c -> d -> m e
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
{-# INLINE szipWith4M #-}
szipWith5M
:: forall ra rb rc rd re a b c d e f m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, Monad m
)
=> (a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m (Vector DS f)
szipWith5M :: forall ra rb rc rd re a b c d e f (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Monad m) =>
(a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m (Vector DS f)
szipWith5M a -> b -> c -> d -> e -> m f
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 =
forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> m f)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
S.zipWith5M a -> b -> c -> d -> e -> m f
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
{-# INLINE szipWith5M #-}
szipWith6M
:: forall ra rb rc rd re rf a b c d e f g m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, S.Stream rf Ix1 f
, Monad m
)
=> (a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m (Vector DS g)
szipWith6M :: forall ra rb rc rd re rf a b c d e f g (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f, Monad m) =>
(a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m (Vector DS g)
szipWith6M a -> b -> c -> d -> e -> f -> m g
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 Vector rf f
v6 =
forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> m g)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> Steps m g
S.zipWith6M
a -> b -> c -> d -> e -> f -> m g
f
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rf f
v6)
{-# INLINE szipWith6M #-}
sizipWithM
:: forall ra rb a b c m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, Monad m)
=> (Ix1 -> a -> b -> m c)
-> Vector ra a
-> Vector rb b
-> m (Vector DS c)
sizipWithM :: forall ra rb a b c (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Monad m) =>
(Int -> a -> b -> m c)
-> Vector ra a -> Vector rb b -> m (Vector DS c)
sizipWithM Int -> a -> b -> m c
f Vector ra a
v1 Vector rb b
v2 = forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Steps m a -> Steps m b -> Steps m c
S.zipWithM (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> m c
f) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
{-# INLINE sizipWithM #-}
sizipWith3M
:: forall ra rb rc a b c d m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, Monad m)
=> (Ix1 -> a -> b -> c -> m d)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> m (Vector DS d)
sizipWith3M :: forall ra rb rc a b c d (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c, Monad m) =>
(Int -> a -> b -> c -> m d)
-> Vector ra a -> Vector rb b -> Vector rc c -> m (Vector DS d)
sizipWith3M Int -> a -> b -> c -> m d
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 =
forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> m d)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d
S.zipWith3M (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> m d
f) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
{-# INLINE sizipWith3M #-}
sizipWith4M
:: forall ra rb rc rd a b c d e m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d, Monad m)
=> (Ix1 -> a -> b -> c -> d -> m e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> m (Vector DS e)
sizipWith4M :: forall ra rb rc rd a b c d e (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Monad m) =>
(Int -> a -> b -> c -> d -> m e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> m (Vector DS e)
sizipWith4M Int -> a -> b -> c -> d -> m e
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 =
forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> m e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> Steps m e
S.zipWith4M (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> m e
f) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
{-# INLINE sizipWith4M #-}
sizipWith5M
:: forall ra rb rc rd re a b c d e f m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, Monad m
)
=> (Ix1 -> a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m (Vector DS f)
sizipWith5M :: forall ra rb rc rd re a b c d e f (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Monad m) =>
(Int -> a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m (Vector DS f)
sizipWith5M Int -> a -> b -> c -> d -> e -> m f
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 =
forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> m f)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
S.zipWith5M
(forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> m f
f)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
{-# INLINE sizipWith5M #-}
sizipWith6M
:: forall ra rb rc rd re rf a b c d e f g m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, S.Stream rf Ix1 f
, Monad m
)
=> (Ix1 -> a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m (Vector DS g)
sizipWith6M :: forall ra rb rc rd re rf a b c d e f g (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f, Monad m) =>
(Int -> a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m (Vector DS g)
sizipWith6M Int -> a -> b -> c -> d -> e -> f -> m g
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 Vector rf f
v6 =
forall (m :: * -> *) e. Monad m => Steps m e -> m (Vector DS e)
fromStepsM forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> m g)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> Steps m g
S.zipWith6M
(forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f -> m g
f)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rf f
v6)
{-# INLINE sizipWith6M #-}
szipWithM_
:: forall ra rb a b c m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, Monad m)
=> (a -> b -> m c)
-> Vector ra a
-> Vector rb b
-> m ()
szipWithM_ :: forall ra rb a b c (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Monad m) =>
(a -> b -> m c) -> Vector ra a -> Vector rb b -> m ()
szipWithM_ a -> b -> m c
f Vector ra a
v1 Vector rb b
v2 = forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Steps m a -> Steps m b -> m ()
S.zipWithM_ a -> b -> m c
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
{-# INLINE szipWithM_ #-}
szipWith3M_
:: forall ra rb rc a b c d m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, Monad m)
=> (a -> b -> c -> m d)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> m ()
szipWith3M_ :: forall ra rb rc a b c d (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c, Monad m) =>
(a -> b -> c -> m d)
-> Vector ra a -> Vector rb b -> Vector rc c -> m ()
szipWith3M_ a -> b -> c -> m d
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 = forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> m d) -> Steps m a -> Steps m b -> Steps m c -> m ()
S.zipWith3M_ a -> b -> c -> m d
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
{-# INLINE szipWith3M_ #-}
szipWith4M_
:: forall ra rb rc rd a b c d e m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d, Monad m)
=> (a -> b -> c -> d -> m e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> m ()
szipWith4M_ :: forall ra rb rc rd a b c d e (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Monad m) =>
(a -> b -> c -> d -> m e)
-> Vector ra a -> Vector rb b -> Vector rc c -> Vector rd d -> m ()
szipWith4M_ a -> b -> c -> d -> m e
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 =
forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> m e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> m ()
S.zipWith4M_ a -> b -> c -> d -> m e
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
{-# INLINE szipWith4M_ #-}
szipWith5M_
:: forall ra rb rc rd re a b c d e f m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, Monad m
)
=> (a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m ()
szipWith5M_ :: forall ra rb rc rd re a b c d e f (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Monad m) =>
(a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m ()
szipWith5M_ a -> b -> c -> d -> e -> m f
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 =
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> m f)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> m ()
S.zipWith5M_ a -> b -> c -> d -> e -> m f
f (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
{-# INLINE szipWith5M_ #-}
szipWith6M_
:: forall ra rb rc rd re rf a b c d e f g m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, S.Stream rf Ix1 f
, Monad m
)
=> (a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m ()
szipWith6M_ :: forall ra rb rc rd re rf a b c d e f g (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f, Monad m) =>
(a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m ()
szipWith6M_ a -> b -> c -> d -> e -> f -> m g
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 Vector rf f
v6 =
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> m g)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> m ()
S.zipWith6M_
a -> b -> c -> d -> e -> f -> m g
f
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rf f
v6)
{-# INLINE szipWith6M_ #-}
sizipWithM_
:: forall ra rb a b c m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, Monad m)
=> (Ix1 -> a -> b -> m c)
-> Vector ra a
-> Vector rb b
-> m ()
sizipWithM_ :: forall ra rb a b c (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Monad m) =>
(Int -> a -> b -> m c) -> Vector ra a -> Vector rb b -> m ()
sizipWithM_ Int -> a -> b -> m c
f Vector ra a
v1 Vector rb b
v2 = forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Steps m a -> Steps m b -> m ()
S.zipWithM_ (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> m c
f) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
{-# INLINE sizipWithM_ #-}
sizipWith3M_
:: forall ra rb rc a b c d m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, Monad m)
=> (Ix1 -> a -> b -> c -> m d)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> m ()
sizipWith3M_ :: forall ra rb rc a b c d (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c, Monad m) =>
(Int -> a -> b -> c -> m d)
-> Vector ra a -> Vector rb b -> Vector rc c -> m ()
sizipWith3M_ Int -> a -> b -> c -> m d
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 = forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> m d) -> Steps m a -> Steps m b -> Steps m c -> m ()
S.zipWith3M_ (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> m d
f) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
{-# INLINE sizipWith3M_ #-}
sizipWith4M_
:: forall ra rb rc rd a b c d e m
. (S.Stream ra Ix1 a, S.Stream rb Ix1 b, S.Stream rc Ix1 c, S.Stream rd Ix1 d, Monad m)
=> (Ix1 -> a -> b -> c -> d -> m e)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> m ()
sizipWith4M_ :: forall ra rb rc rd a b c d e (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Monad m) =>
(Int -> a -> b -> c -> d -> m e)
-> Vector ra a -> Vector rb b -> Vector rc c -> Vector rd d -> m ()
sizipWith4M_ Int -> a -> b -> c -> d -> m e
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 =
forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> m e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> m ()
S.zipWith4M_ (forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> m e
f) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
{-# INLINE sizipWith4M_ #-}
sizipWith5M_
:: forall ra rb rc rd re a b c d e f m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, Monad m
)
=> (Ix1 -> a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m ()
sizipWith5M_ :: forall ra rb rc rd re a b c d e f (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Monad m) =>
(Int -> a -> b -> c -> d -> e -> m f)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> m ()
sizipWith5M_ Int -> a -> b -> c -> d -> e -> m f
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 =
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> m f)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> m ()
S.zipWith5M_
(forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> m f
f)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
{-# INLINE sizipWith5M_ #-}
sizipWith6M_
:: forall ra rb rc rd re rf a b c d e f g m
. ( S.Stream ra Ix1 a
, S.Stream rb Ix1 b
, S.Stream rc Ix1 c
, S.Stream rd Ix1 d
, S.Stream re Ix1 e
, S.Stream rf Ix1 f
, Monad m
)
=> (Ix1 -> a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m ()
sizipWith6M_ :: forall ra rb rc rd re rf a b c d e f g (m :: * -> *).
(Stream ra Int a, Stream rb Int b, Stream rc Int c,
Stream rd Int d, Stream re Int e, Stream rf Int f, Monad m) =>
(Int -> a -> b -> c -> d -> e -> f -> m g)
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector rf f
-> m ()
sizipWith6M_ Int -> a -> b -> c -> d -> e -> f -> m g
f Vector ra a
v1 Vector rb b
v2 Vector rc c
v3 Vector rd d
v4 Vector re e
v5 Vector rf f
v6 =
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> m g)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> m ()
S.zipWith6M_
(forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f -> m g
f)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rf f
v6)
{-# INLINE sizipWith6M_ #-}
sfoldl
:: forall r ix e a
. Stream r ix e
=> (a -> e -> a)
-> a
-> Array r ix e
-> a
sfoldl :: forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> a
sfoldl a -> e -> a
f a
acc = forall a. Id a -> a
S.unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) b a.
Monad m =>
(b -> a -> b) -> b -> Steps m a -> m b
S.foldl a -> e -> a
f a
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sfoldl #-}
sfoldlM
:: forall r ix e a m
. (Stream r ix e, Monad m)
=> (a -> e -> m a)
-> a
-> Array r ix e
-> m a
sfoldlM :: forall r ix e a (m :: * -> *).
(Stream r ix e, Monad m) =>
(a -> e -> m a) -> a -> Array r ix e -> m a
sfoldlM a -> e -> m a
f a
acc = forall (m :: * -> *) a b.
Monad m =>
(a -> b -> m a) -> a -> Steps m b -> m a
S.foldlM a -> e -> m a
f a
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sfoldlM #-}
sfoldlM_
:: forall r ix e a m
. (Stream r ix e, Monad m)
=> (a -> e -> m a)
-> a
-> Array r ix e
-> m ()
sfoldlM_ :: forall r ix e a (m :: * -> *).
(Stream r ix e, Monad m) =>
(a -> e -> m a) -> a -> Array r ix e -> m ()
sfoldlM_ a -> e -> m a
f a
acc = forall (f :: * -> *) a. Functor f => f a -> f ()
void forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e a (m :: * -> *).
(Stream r ix e, Monad m) =>
(a -> e -> m a) -> a -> Array r ix e -> m a
sfoldlM a -> e -> m a
f a
acc
{-# INLINE sfoldlM_ #-}
sfoldl1'
:: forall r ix e
. (HasCallStack, Stream r ix e)
=> (e -> e -> e)
-> Array r ix e
-> e
sfoldl1' :: forall r ix e.
(HasCallStack, Stream r ix e) =>
(e -> e -> e) -> Array r ix e -> e
sfoldl1' e -> e -> e
f = forall a. HasCallStack => Either SomeException a -> a
throwEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e (m :: * -> *).
(Stream r ix e, MonadThrow m) =>
(e -> e -> m e) -> Array r ix e -> m e
sfoldl1M (\e
e -> forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> e -> e
f e
e)
{-# INLINE sfoldl1' #-}
sfoldl1M
:: forall r ix e m
. (Stream r ix e, MonadThrow m)
=> (e -> e -> m e)
-> Array r ix e
-> m e
sfoldl1M :: forall r ix e (m :: * -> *).
(Stream r ix e, MonadThrow m) =>
(e -> e -> m e) -> Array r ix e -> m e
sfoldl1M e -> e -> m e
f Array r ix e
arr = do
let str :: Steps m e
str = forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId forall a b. (a -> b) -> a -> b
$ forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Array r ix e
arr
Bool
isNullStream <- forall (m :: * -> *) a. Monad m => Steps m a -> m Bool
S.null Steps m e
str
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
isNullStream forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM forall a b. (a -> b) -> a -> b
$ forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (forall r ix e. Shape r ix => Array r ix e -> Sz ix
outerSize Array r ix e
arr)
forall (m :: * -> *) a.
Monad m =>
(a -> a -> m a) -> Steps m a -> m a
S.foldl1M e -> e -> m e
f Steps m e
str
{-# INLINE sfoldl1M #-}
sfoldl1M_
:: forall r ix e m
. (Stream r ix e, MonadThrow m)
=> (e -> e -> m e)
-> Array r ix e
-> m ()
sfoldl1M_ :: forall r ix e (m :: * -> *).
(Stream r ix e, MonadThrow m) =>
(e -> e -> m e) -> Array r ix e -> m ()
sfoldl1M_ e -> e -> m e
f = forall (f :: * -> *) a. Functor f => f a -> f ()
void forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e (m :: * -> *).
(Stream r ix e, MonadThrow m) =>
(e -> e -> m e) -> Array r ix e -> m e
sfoldl1M e -> e -> m e
f
{-# INLINE sfoldl1M_ #-}
sifoldl
:: forall r ix e a
. Stream r ix e
=> (a -> ix -> e -> a)
-> a
-> Array r ix e
-> a
sifoldl :: forall r ix e a.
Stream r ix e =>
(a -> ix -> e -> a) -> a -> Array r ix e -> a
sifoldl a -> ix -> e -> a
f a
acc = forall a. Id a -> a
S.unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) b a.
Monad m =>
(b -> a -> b) -> b -> Steps m a -> m b
S.foldl (\a
a (ix
ix, e
e) -> a -> ix -> e -> a
f a
a ix
ix e
e) a
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE sifoldl #-}
sifoldlM
:: forall r ix e a m
. (Stream r ix e, Monad m)
=> (a -> ix -> e -> m a)
-> a
-> Array r ix e
-> m a
sifoldlM :: forall r ix e a (m :: * -> *).
(Stream r ix e, Monad m) =>
(a -> ix -> e -> m a) -> a -> Array r ix e -> m a
sifoldlM a -> ix -> e -> m a
f a
acc = forall (m :: * -> *) a b.
Monad m =>
(a -> b -> m a) -> a -> Steps m b -> m a
S.foldlM (\a
a (ix
ix, e
e) -> a -> ix -> e -> m a
f a
a ix
ix e
e) a
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE sifoldlM #-}
sifoldlM_
:: forall r ix e a m
. (Stream r ix e, Monad m)
=> (a -> ix -> e -> m a)
-> a
-> Array r ix e
-> m ()
sifoldlM_ :: forall r ix e a (m :: * -> *).
(Stream r ix e, Monad m) =>
(a -> ix -> e -> m a) -> a -> Array r ix e -> m ()
sifoldlM_ a -> ix -> e -> m a
f a
acc = forall (f :: * -> *) a. Functor f => f a -> f ()
void forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e a (m :: * -> *).
(Stream r ix e, Monad m) =>
(a -> ix -> e -> m a) -> a -> Array r ix e -> m a
sifoldlM a -> ix -> e -> m a
f a
acc
{-# INLINE sifoldlM_ #-}
sor
:: forall r ix
. Stream r ix Bool
=> Array r ix Bool
-> Bool
sor :: forall r ix. Stream r ix Bool => Array r ix Bool -> Bool
sor = forall a. Id a -> a
S.unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.or forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sor #-}
sand :: forall r ix. Stream r ix Bool => Array r ix Bool -> Bool
sand :: forall r ix. Stream r ix Bool => Array r ix Bool -> Bool
sand = forall a. Id a -> a
S.unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.and forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sand #-}
sany :: forall r ix e. Stream r ix e => (e -> Bool) -> Array r ix e -> Bool
sany :: forall r ix e. Stream r ix e => (e -> Bool) -> Array r ix e -> Bool
sany e -> Bool
f = forall a. Id a -> a
S.unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.or forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map e -> Bool
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sany #-}
sall :: forall r ix e. Stream r ix e => (e -> Bool) -> Array r ix e -> Bool
sall :: forall r ix e. Stream r ix e => (e -> Bool) -> Array r ix e -> Bool
sall e -> Bool
f = forall a. Id a -> a
S.unId forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.and forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map e -> Bool
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sall #-}
ssum :: forall r ix e. (Num e, Stream r ix e) => Array r ix e -> e
ssum :: forall r ix e. (Num e, Stream r ix e) => Array r ix e -> e
ssum = forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> a
sfoldl forall a. Num a => a -> a -> a
(+) e
0
{-# INLINE ssum #-}
sproduct :: forall r ix e. (Num e, Stream r ix e) => Array r ix e -> e
sproduct :: forall r ix e. (Num e, Stream r ix e) => Array r ix e -> e
sproduct = forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> a
sfoldl forall a. Num a => a -> a -> a
(*) e
1
{-# INLINE sproduct #-}
smaximum' :: forall r ix e. (HasCallStack, Ord e, Stream r ix e) => Array r ix e -> e
smaximum' :: forall r ix e.
(HasCallStack, Ord e, Stream r ix e) =>
Array r ix e -> e
smaximum' = forall r ix e.
(HasCallStack, Stream r ix e) =>
(e -> e -> e) -> Array r ix e -> e
sfoldl1' forall a. Ord a => a -> a -> a
max
{-# INLINE smaximum' #-}
smaximumM :: forall r ix e m. (Ord e, Stream r ix e, MonadThrow m) => Array r ix e -> m e
smaximumM :: forall r ix e (m :: * -> *).
(Ord e, Stream r ix e, MonadThrow m) =>
Array r ix e -> m e
smaximumM = forall r ix e (m :: * -> *).
(Stream r ix e, MonadThrow m) =>
(e -> e -> m e) -> Array r ix e -> m e
sfoldl1M (\e
e e
acc -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall a. Ord a => a -> a -> a
max e
e e
acc))
{-# INLINE smaximumM #-}
sminimum' :: forall r ix e. (HasCallStack, Ord e, Stream r ix e) => Array r ix e -> e
sminimum' :: forall r ix e.
(HasCallStack, Ord e, Stream r ix e) =>
Array r ix e -> e
sminimum' = forall r ix e.
(HasCallStack, Stream r ix e) =>
(e -> e -> e) -> Array r ix e -> e
sfoldl1' forall a. Ord a => a -> a -> a
min
{-# INLINE sminimum' #-}
sminimumM :: forall r ix e m. (Ord e, Stream r ix e, MonadThrow m) => Array r ix e -> m e
sminimumM :: forall r ix e (m :: * -> *).
(Ord e, Stream r ix e, MonadThrow m) =>
Array r ix e -> m e
sminimumM = forall r ix e (m :: * -> *).
(Stream r ix e, MonadThrow m) =>
(e -> e -> m e) -> Array r ix e -> m e
sfoldl1M (\e
e e
acc -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall a. Ord a => a -> a -> a
min e
e e
acc))
{-# INLINE sminimumM #-}
sprescanl :: Stream r ix e => (a -> e -> a) -> a -> Array r ix e -> Vector DS a
sprescanl :: forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> Vector DS a
sprescanl a -> e -> a
f a
acc = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a b.
Monad m =>
(a -> b -> m a) -> a -> Steps m b -> Steps m a
S.prescanlM (\a
a e
b -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> e -> a
f a
a e
b)) a
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sprescanl #-}
spostscanl :: Stream r ix e => (a -> e -> a) -> a -> Array r ix e -> Vector DS a
spostscanl :: forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> Vector DS a
spostscanl a -> e -> a
f a
acc = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a b.
Monad m =>
(a -> b -> m a) -> a -> Steps m b -> Steps m a
S.postscanlM (\a
a e
b -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> e -> a
f a
a e
b)) a
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE spostscanl #-}
spostscanlAcc :: Stream r ix e => (c -> e -> (a, c)) -> c -> Array r ix e -> Vector DS a
spostscanlAcc :: forall r ix e c a.
Stream r ix e =>
(c -> e -> (a, c)) -> c -> Array r ix e -> Vector DS a
spostscanlAcc c -> e -> (a, c)
f c
acc = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) c b a.
Monad m =>
(c -> b -> m (a, c)) -> c -> Steps m b -> Steps m a
S.postscanlAccM (\c
a e
b -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (c -> e -> (a, c)
f c
a e
b)) c
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE spostscanlAcc #-}
sscanl :: Stream r ix e => (a -> e -> a) -> a -> Array r ix e -> Vector DS a
sscanl :: forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> Vector DS a
sscanl a -> e -> a
f a
acc = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a b.
Monad m =>
(a -> b -> m a) -> a -> Steps m b -> Steps m a
S.scanlM (\a
a e
b -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> e -> a
f a
a e
b)) a
acc forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sscanl #-}
sscanl1 :: Stream r ix e => (e -> e -> e) -> Array r ix e -> Vector DS e
sscanl1 :: forall r ix e.
Stream r ix e =>
(e -> e -> e) -> Array r ix e -> Vector DS e
sscanl1 e -> e -> e
f = forall e. Steps Id e -> Vector DS e
DSArray forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
Monad m =>
(a -> a -> m a) -> Steps m a -> Steps m a
S.scanl1M (\e
a e
b -> forall (f :: * -> *) a. Applicative f => a -> f a
pure (e -> e -> e
f e
a e
b)) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sscanl1 #-}