{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
module Data.Massiv.Vector
( Vector
, MVector
, slength
, maxSize
, size
, snull
, (!?)
, (!)
, 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
, stoList
, fromList
, sfromList
, sfromListN
, compute
, computeS
, computeIO
, computePrimM
, computeAs
, computeProxy
, computeSource
, computeWithStride
, computeWithStrideAs
, clone
, convert
, convertAs
, convertProxy
, takeS
, dropS
, unfoldr
, unfoldrN
, filterS
, ifilterS
, filterM
, ifilterM
, mapMaybeS
, imapMaybeS
, mapMaybeM
, imapMaybeM
, catMaybesS
, traverseS
, 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 (makeArrayR, 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, init, length, null, replicate, splitAt, tail, take, takeWhile, dropWhile)
slength :: Stream r ix e => Array r ix e -> Maybe Sz1
slength :: Array r ix e -> Maybe Sz1
slength Array r ix e
v =
case Steps Id e -> Size
forall (m :: * -> *) e. Steps m e -> Size
stepsSize (Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Array r ix e
v) of
Exact Int
sz -> Sz1 -> Maybe Sz1
forall a. a -> Maybe a
Just (Int -> Sz1
forall ix. ix -> Sz ix
SafeSz Int
sz)
Size
_ -> Maybe Sz1
forall a. Maybe a
Nothing
{-# INLINE slength #-}
snull :: Load r ix e => Array r ix e -> Bool
snull :: Array r ix e -> Bool
snull = Array r ix e -> Bool
forall r ix e. Load r ix e => Array r ix e -> Bool
isEmpty
{-# INLINE snull #-}
head' :: Source r Ix1 e => Vector r e -> e
head' :: Vector r e -> e
head' = (SomeException -> e) -> (e -> e) -> Either SomeException e -> e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> e
forall a e. Exception e => e -> a
throw e -> e
forall a. a -> a
id (Either SomeException e -> e)
-> (Vector r e -> Either SomeException e) -> Vector r e -> e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Either SomeException e
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Vector r e -> m e
headM
{-# INLINE head' #-}
headM :: (Source r Ix1 e, MonadThrow m) => Vector r e -> m e
headM :: Vector r e -> m e
headM Vector r e
v
| Vector r e -> Bool
forall r ix e. Load r ix e => Array r ix e -> Bool
isEmpty Vector r e
v = SizeException -> m e
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m e) -> SizeException -> m e
forall a b. (a -> b) -> a -> b
$ Sz1 -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v)
| Bool
otherwise = e -> m e
forall (f :: * -> *) a. Applicative f => a -> f a
pure (e -> m e) -> e -> m e
forall a b. (a -> b) -> a -> b
$ Vector r e -> Int -> e
forall r ix e. Source r ix e => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v Int
0
{-# INLINE headM #-}
shead' :: Stream r Ix1 e => Vector r e -> e
shead' :: Vector r e -> e
shead' = (SomeException -> e) -> (e -> e) -> Either SomeException e -> e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> e
forall a e. Exception e => e -> a
throw e -> e
forall a. a -> a
id (Either SomeException e -> e)
-> (Vector r e -> Either SomeException e) -> Vector r e -> e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Either SomeException e
forall r e (m :: * -> *).
(Stream r Int e, MonadThrow m) =>
Vector r e -> m e
sheadM
{-# INLINE shead' #-}
sheadM :: (Stream r Ix1 e, MonadThrow m) => Vector r e -> m e
sheadM :: Vector r e -> m e
sheadM Vector r e
v =
case Id (Maybe e) -> Maybe e
forall a. Id a -> a
S.unId (Steps Id e -> Id (Maybe e)
forall (m :: * -> *) a. Monad m => Steps m a -> m (Maybe a)
S.headMaybe (Vector r e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Vector r e
v)) of
Maybe e
Nothing -> SizeException -> m e
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m e) -> SizeException -> m e
forall a b. (a -> b) -> a -> b
$ Sz1 -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v)
Just e
e -> e -> m e
forall (f :: * -> *) a. Applicative f => a -> f a
pure e
e
{-# INLINE sheadM #-}
unconsM :: (MonadThrow m, Source r Ix1 e) => Vector r e -> m (e, Vector r e)
unconsM :: Vector r e -> m (e, Vector r e)
unconsM Vector r e
arr
| Int
0 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Sz1 -> Int
forall ix. Index ix => Sz ix -> Int
totalElem Sz1
sz = SizeException -> m (e, Vector r e)
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m (e, Vector r e))
-> SizeException -> m (e, Vector r e)
forall a b. (a -> b) -> a -> b
$ Sz1 -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException Sz1
sz
| Bool
otherwise = (e, Vector r e) -> m (e, Vector r e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e -> Int -> e
forall r ix e. Source r ix e => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
arr Int
0, Int -> Sz1 -> Vector r e -> Vector r e
forall r ix e.
Source r ix e =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
1 (Int -> Sz1
forall ix. ix -> Sz ix
SafeSz (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
sz Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1)) Vector r e
arr)
where
!sz :: Sz1
sz = Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
arr
{-# INLINE unconsM #-}
unsnocM :: (MonadThrow m, Source r Ix1 e) => Vector r e -> m (Vector r e, e)
unsnocM :: Vector r e -> m (Vector r e, e)
unsnocM Vector r e
arr
| Int
0 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Sz1 -> Int
forall ix. Index ix => Sz ix -> Int
totalElem Sz1
sz = SizeException -> m (Vector r e, e)
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m (Vector r e, e))
-> SizeException -> m (Vector r e, e)
forall a b. (a -> b) -> a -> b
$ Sz1 -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException Sz1
sz
| Bool
otherwise = (Vector r e, e) -> m (Vector r e, e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int -> Sz1 -> Vector r e -> Vector r e
forall r ix e.
Source r ix e =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
0 (Int -> Sz1
forall ix. ix -> Sz ix
SafeSz Int
k) Vector r e
arr, Vector r e -> Int -> e
forall r ix e. Source r ix e => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
arr Int
k)
where
!sz :: Sz1
sz = Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
arr
!k :: Int
k = Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
sz Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1
{-# INLINE unsnocM #-}
last' :: Source r Ix1 e => Vector r e -> e
last' :: Vector r e -> e
last' = (SomeException -> e) -> (e -> e) -> Either SomeException e -> e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> e
forall a e. Exception e => e -> a
throw e -> e
forall a. a -> a
id (Either SomeException e -> e)
-> (Vector r e -> Either SomeException e) -> Vector r e -> e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Either SomeException e
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Vector r e -> m e
lastM
{-# INLINE last' #-}
lastM :: (Source r Ix1 e, MonadThrow m) => Vector r e -> m e
lastM :: Vector r e -> m e
lastM Vector r e
v
| Int
k Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = SizeException -> m e
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m e) -> SizeException -> m e
forall a b. (a -> b) -> a -> b
$ Sz1 -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v)
| Bool
otherwise = e -> m e
forall (f :: * -> *) a. Applicative f => a -> f a
pure (e -> m e) -> e -> m e
forall a b. (a -> b) -> a -> b
$ Vector r e -> Int -> e
forall r ix e. Source r ix e => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v (Int
k Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1)
where k :: Int
k = Sz1 -> Int
forall ix. Sz ix -> ix
unSz (Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v)
{-# INLINE lastM #-}
slice :: Source r Ix1 e => Ix1 -> Sz1 -> Vector r e -> Vector r e
slice :: Int -> Sz1 -> Vector r e -> Vector r e
slice !Int
i (Sz Int
k) Vector r e
v = Int -> Sz1 -> Vector r e -> Vector r e
forall r ix e.
Source r ix e =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
i' Sz1
newSz Vector r e
v
where
!i' :: Int
i' = Int -> Int -> Int
forall a. Ord a => a -> a -> a
min Int
n (Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
0 Int
i)
!newSz :: Sz1
newSz = Int -> Sz1
forall ix. ix -> Sz ix
SafeSz (Int -> Int -> Int
forall a. Ord a => a -> a -> a
min (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
i') Int
k)
Sz Int
n = Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v
{-# INLINE slice #-}
slice' :: Source r Ix1 e => Ix1 -> Sz1 -> Vector r e -> Vector r e
slice' :: Int -> Sz1 -> Vector r e -> Vector r e
slice' Int
i Sz1
k = (SomeException -> Vector r e)
-> (Vector r e -> Vector r e)
-> Either SomeException (Vector r e)
-> Vector r e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> Vector r e
forall a e. Exception e => e -> a
throw Vector r e -> Vector r e
forall a. a -> a
id (Either SomeException (Vector r e) -> Vector r e)
-> (Vector r e -> Either SomeException (Vector r e))
-> Vector r e
-> Vector r e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Sz1 -> Vector r e -> Either SomeException (Vector r e)
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Int -> Sz1 -> Vector r e -> m (Vector r e)
sliceM Int
i Sz1
k
{-# INLINE slice' #-}
sliceM :: (Source r Ix1 e, MonadThrow m) => Ix1 -> Sz1 -> Vector r e -> m (Vector r e)
sliceM :: Int -> Sz1 -> Vector r e -> m (Vector r e)
sliceM Int
i newSz :: Sz1
newSz@(Sz Int
k) Vector r e
v
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
0 Bool -> Bool -> Bool
&& Int
k Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
i = Vector r e -> m (Vector r e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e -> m (Vector r e)) -> Vector r e -> m (Vector r e)
forall a b. (a -> b) -> a -> b
$ Int -> Sz1 -> Vector r e -> Vector r e
forall r ix e.
Source r ix e =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
i Sz1
newSz Vector r e
v
| Bool
otherwise = SizeException -> m (Vector r e)
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m (Vector r e))
-> SizeException -> m (Vector r e)
forall a b. (a -> b) -> a -> b
$ Sz1 -> Int -> Sz1 -> SizeException
forall ix. Index ix => Sz ix -> ix -> Sz ix -> SizeException
SizeSubregionException Sz1
sz Int
i Sz1
newSz
where
sz :: Sz1
sz@(Sz Int
n) = Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v
{-# INLINE sliceM #-}
sslice :: Stream r Ix1 e => Ix1 -> Sz1 -> Vector r e -> Vector DS e
sslice :: Int -> Sz1 -> Vector r e -> Vector DS e
sslice !Int
i (Sz Int
k) = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e)
-> (Vector r e -> Steps Id e) -> Vector r e -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Steps Id e -> Steps Id e
forall (m :: * -> *) a.
Monad m =>
Int -> Int -> Steps m a -> Steps m a
S.slice Int
i Int
k (Steps Id e -> Steps Id e)
-> (Vector r e -> Steps Id e) -> Vector r e -> Steps Id e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE sslice #-}
init :: Source r Ix1 e => Vector r e -> Vector r e
init :: Vector r e -> Vector r e
init Vector r e
v = Int -> Sz1 -> Vector r e -> Vector r e
forall r ix e.
Source r ix e =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
0 (Int -> Sz1
forall ix. Index ix => ix -> Sz ix
Sz (Sz1 -> Int
coerce (Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v) Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1)) Vector r e
v
{-# INLINE init #-}
init' :: Source r Ix1 e => Vector r e -> Vector r e
init' :: Vector r e -> Vector r e
init' = (SomeException -> Vector r e)
-> (Vector r e -> Vector r e)
-> Either SomeException (Vector r e)
-> Vector r e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> Vector r e
forall a e. Exception e => e -> a
throw Vector r e -> Vector r e
forall a. a -> a
id (Either SomeException (Vector r e) -> Vector r e)
-> (Vector r e -> Either SomeException (Vector r e))
-> Vector r e
-> Vector r e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Either SomeException (Vector r e)
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Vector r e -> m (Vector r e)
initM
{-# INLINE init' #-}
initM :: (Source r Ix1 e, MonadThrow m) => Vector r e -> m (Vector r e)
initM :: Vector r e -> m (Vector r e)
initM Vector r e
v = do
Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Vector r e -> Bool
forall r ix e. Load r ix e => Array r ix e -> Bool
isEmpty Vector r e
v) (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ SizeException -> m ()
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m ()) -> SizeException -> m ()
forall a b. (a -> b) -> a -> b
$ Sz1 -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (Sz1 -> SizeException) -> Sz1 -> SizeException
forall a b. (a -> b) -> a -> b
$ Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v
Vector r e -> m (Vector r e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e -> m (Vector r e)) -> Vector r e -> m (Vector r e)
forall a b. (a -> b) -> a -> b
$ Vector r e -> Vector r e
forall r e. Source r Int e => Vector r e -> Vector r e
unsafeInit Vector r e
v
{-# INLINE initM #-}
tail :: Source r Ix1 e => Vector r e -> Vector r e
tail :: Vector r e -> Vector r e
tail = Sz1 -> Vector r e -> Vector r e
forall r e. Source r Int e => Sz1 -> Vector r e -> Vector r e
drop Sz1
1
{-# INLINE tail #-}
tail' :: Source r Ix1 e => Vector r e -> Vector r e
tail' :: Vector r e -> Vector r e
tail' = (SomeException -> Vector r e)
-> (Vector r e -> Vector r e)
-> Either SomeException (Vector r e)
-> Vector r e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> Vector r e
forall a e. Exception e => e -> a
throw Vector r e -> Vector r e
forall a. a -> a
id (Either SomeException (Vector r e) -> Vector r e)
-> (Vector r e -> Either SomeException (Vector r e))
-> Vector r e
-> Vector r e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Either SomeException (Vector r e)
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Vector r e -> m (Vector r e)
tailM
{-# INLINE tail' #-}
tailM :: (Source r Ix1 e, MonadThrow m) => Vector r e -> m (Vector r e)
tailM :: Vector r e -> m (Vector r e)
tailM Vector r e
v = do
Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Vector r e -> Bool
forall r ix e. Load r ix e => Array r ix e -> Bool
isEmpty Vector r e
v) (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ SizeException -> m ()
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m ()) -> SizeException -> m ()
forall a b. (a -> b) -> a -> b
$ Sz1 -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (Sz1 -> SizeException) -> Sz1 -> SizeException
forall a b. (a -> b) -> a -> b
$ Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v
Vector r e -> m (Vector r e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e -> m (Vector r e)) -> Vector r e -> m (Vector r e)
forall a b. (a -> b) -> a -> b
$ Vector r e -> Vector r e
forall r e. Source r Int e => Vector r e -> Vector r e
unsafeTail Vector r e
v
{-# INLINE tailM #-}
take :: Source r Ix1 e => Sz1 -> Vector r e -> Vector r e
take :: Sz1 -> Vector r e -> Vector r e
take Sz1
k = (Vector r e, Vector r e) -> Vector r e
forall a b. (a, b) -> a
fst ((Vector r e, Vector r e) -> Vector r e)
-> (Vector r e -> (Vector r e, Vector r e))
-> Vector r e
-> Vector r e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sz1 -> Vector r e -> (Vector r e, Vector r e)
forall r e.
Source r Int e =>
Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt Sz1
k
{-# INLINE take #-}
takeWhile :: Manifest r Ix1 e => (e -> Bool) -> Vector r e -> Vector r e
takeWhile :: (e -> Bool) -> Vector r e -> Vector r e
takeWhile e -> Bool
f Vector r e
v = Sz1 -> Vector r e -> Vector r e
forall r e. Source r Int e => Sz1 -> Vector r e -> Vector r e
take (Int -> Sz1
go Int
0) Vector r e
v
where
!k :: Int
k = Vector r e -> Int
forall r ix e. Load r ix e => Array r ix e -> Int
elemsCount Vector r e
v
go :: Int -> Sz1
go !Int
i
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
k Bool -> Bool -> Bool
&& e -> Bool
f (Vector r e -> Int -> e
forall r ix e. Source r ix e => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v Int
i) = Int -> Sz1
go (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
| Bool
otherwise = Int -> Sz1
forall ix. ix -> Sz ix
SafeSz Int
i
{-# INLINE takeWhile #-}
take' :: Source r Ix1 e => Sz1 -> Vector r e -> Vector r e
take' :: Sz1 -> Vector r e -> Vector r e
take' Sz1
k = (SomeException -> Vector r e)
-> (Vector r e -> Vector r e)
-> Either SomeException (Vector r e)
-> Vector r e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> Vector r e
forall a e. Exception e => e -> a
throw Vector r e -> Vector r e
forall a. a -> a
id (Either SomeException (Vector r e) -> Vector r e)
-> (Vector r e -> Either SomeException (Vector r e))
-> Vector r e
-> Vector r e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sz1 -> Vector r e -> Either SomeException (Vector r e)
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
takeM Sz1
k
{-# INLINE take' #-}
takeM :: (Source r Ix1 e, MonadThrow m) => Sz1 -> Vector r e -> m (Vector r e)
takeM :: Sz1 -> Vector r e -> m (Vector r e)
takeM Sz1
k Vector r e
v = do
let sz :: Sz1
sz = Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v
Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Sz1
k Sz1 -> Sz1 -> Bool
forall a. Ord a => a -> a -> Bool
> Sz1
sz) (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ SizeException -> m ()
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m ()) -> SizeException -> m ()
forall a b. (a -> b) -> a -> b
$ Sz1 -> Int -> Sz1 -> SizeException
forall ix. Index ix => Sz ix -> ix -> Sz ix -> SizeException
SizeSubregionException Sz1
sz Int
0 Sz1
k
Vector r e -> m (Vector r e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e -> m (Vector r e)) -> Vector r e -> m (Vector r e)
forall a b. (a -> b) -> a -> b
$ Sz1 -> Vector r e -> Vector r e
forall r e. Source r Int e => Sz1 -> Vector r e -> Vector r e
unsafeTake Sz1
k Vector r e
v
{-# INLINE takeM #-}
stake :: Stream r Ix1 e => Sz1 -> Vector r e -> Vector DS e
stake :: Sz1 -> Vector r e -> Vector DS e
stake Sz1
n = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e)
-> (Vector r e -> Steps Id e) -> Vector r e -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Steps Id e -> Steps Id e
forall (m :: * -> *) a. Monad m => Int -> Steps m a -> Steps m a
S.take (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) (Steps Id e -> Steps Id e)
-> (Vector r e -> Steps Id e) -> Vector r e -> Steps Id e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE stake #-}
drop :: Source r Ix1 e => Sz1 -> Vector r e -> Vector r e
drop :: Sz1 -> Vector r e -> Vector r e
drop Sz1
k = (Vector r e, Vector r e) -> Vector r e
forall a b. (a, b) -> b
snd ((Vector r e, Vector r e) -> Vector r e)
-> (Vector r e -> (Vector r e, Vector r e))
-> Vector r e
-> Vector r e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sz1 -> Vector r e -> (Vector r e, Vector r e)
forall r e.
Source r Int e =>
Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt Sz1
k
{-# INLINE drop #-}
dropWhile :: Manifest r Ix1 e => (e -> Bool) -> Vector r e -> Vector r e
dropWhile :: (e -> Bool) -> Vector r e -> Vector r e
dropWhile e -> Bool
f Vector r e
v = Sz1 -> Vector r e -> Vector r e
forall r e. Source r Int e => Sz1 -> Vector r e -> Vector r e
drop (Int -> Sz1
go Int
0) Vector r e
v
where
!k :: Int
k = Vector r e -> Int
forall r ix e. Load r ix e => Array r ix e -> Int
elemsCount Vector r e
v
go :: Int -> Sz1
go !Int
i
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
k Bool -> Bool -> Bool
&& e -> Bool
f (Vector r e -> Int -> e
forall r ix e. Source r ix e => Array r ix e -> Int -> e
unsafeLinearIndex Vector r e
v Int
i) = Int -> Sz1
go (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
| Bool
otherwise = Int -> Sz1
forall ix. ix -> Sz ix
SafeSz Int
i
{-# INLINE dropWhile #-}
sdrop :: Stream r Ix1 e => Sz1 -> Vector r e -> Vector DS e
sdrop :: Sz1 -> Vector r e -> Vector DS e
sdrop Sz1
n = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e)
-> (Vector r e -> Steps Id e) -> Vector r e -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Steps Id e -> Steps Id e
forall (m :: * -> *) a. Monad m => Int -> Steps m a -> Steps m a
S.drop (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) (Steps Id e -> Steps Id e)
-> (Vector r e -> Steps Id e) -> Vector r e -> Steps Id e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector r e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE sdrop #-}
drop' :: Source r Ix1 e => Sz1 -> Vector r e -> Vector r e
drop' :: Sz1 -> Vector r e -> Vector r e
drop' Sz1
k = (SomeException -> Vector r e)
-> (Vector r e -> Vector r e)
-> Either SomeException (Vector r e)
-> Vector r e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> Vector r e
forall a e. Exception e => e -> a
throw Vector r e -> Vector r e
forall a. a -> a
id (Either SomeException (Vector r e) -> Vector r e)
-> (Vector r e -> Either SomeException (Vector r e))
-> Vector r e
-> Vector r e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sz1 -> Vector r e -> Either SomeException (Vector r e)
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
dropM Sz1
k
{-# INLINE drop' #-}
dropM :: (Source r Ix1 e, MonadThrow m) => Sz1 -> Vector r e -> m (Vector r e)
dropM :: 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) = Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v
Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Sz1
k Sz1 -> Sz1 -> Bool
forall a. Ord a => a -> a -> Bool
> Sz1
sz) (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ SizeException -> m ()
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m ()) -> SizeException -> m ()
forall a b. (a -> b) -> a -> b
$ Sz1 -> Int -> Sz1 -> SizeException
forall ix. Index ix => Sz ix -> ix -> Sz ix -> SizeException
SizeSubregionException Sz1
sz Int
d (Sz1
sz Sz1 -> Sz1 -> Sz1
forall a. Num a => a -> a -> a
- Sz1
k)
Vector r e -> m (Vector r e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e -> m (Vector r e)) -> Vector r e -> m (Vector r e)
forall a b. (a -> b) -> a -> b
$ Int -> Sz1 -> Vector r e -> Vector r e
forall r ix e.
Source r ix e =>
Int -> Sz1 -> Array r ix e -> Array r Int e
unsafeLinearSlice Int
d (Int -> Sz1
forall ix. ix -> Sz ix
SafeSz (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
d)) Vector r e
v
{-# INLINE dropM #-}
sliceAt :: Source r Ix1 e => Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt :: Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt (Sz Int
k) Vector r e
v = (Sz1 -> Vector r e -> Vector r e
forall r e. Source r Int e => Sz1 -> Vector r e -> Vector r e
unsafeTake Sz1
d Vector r e
v, Sz1 -> Vector r e -> Vector r e
forall r e. Source r Int e => Sz1 -> Vector r e -> Vector r e
unsafeDrop Sz1
d Vector r e
v)
where
!n :: Int
n = Sz1 -> Int
coerce (Vector r e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector r e
v)
!d :: Sz1
d = Int -> Sz1
forall ix. ix -> Sz ix
SafeSz (Int -> Int -> Int
forall a. Ord a => a -> a -> a
min Int
k Int
n)
{-# INLINE sliceAt #-}
sliceAt' :: Source r Ix1 e => Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt' :: Sz1 -> Vector r e -> (Vector r e, Vector r e)
sliceAt' Sz1
k = (SomeException -> (Vector r e, Vector r e))
-> ((Vector r e, Vector r e) -> (Vector r e, Vector r e))
-> Either SomeException (Vector r e, Vector r e)
-> (Vector r e, Vector r e)
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> (Vector r e, Vector r e)
forall a e. Exception e => e -> a
throw (Vector r e, Vector r e) -> (Vector r e, Vector r e)
forall a. a -> a
id (Either SomeException (Vector r e, Vector r e)
-> (Vector r e, Vector r e))
-> (Vector r e -> Either SomeException (Vector r e, Vector r e))
-> Vector r e
-> (Vector r e, Vector r e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sz1 -> Vector r e -> Either SomeException (Vector r e, Vector r e)
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e, Vector r e)
sliceAtM Sz1
k
{-# INLINE sliceAt' #-}
sliceAtM :: (Source r Ix1 e, MonadThrow m) => Sz1 -> Vector r e -> m (Vector r e, Vector r e)
sliceAtM :: Sz1 -> Vector r e -> m (Vector r e, Vector r e)
sliceAtM Sz1
k Vector r e
v = do
Vector r e
l <- Sz1 -> Vector r e -> m (Vector r e)
forall r e (m :: * -> *).
(Source r Int e, MonadThrow m) =>
Sz1 -> Vector r e -> m (Vector r e)
takeM Sz1
k Vector r e
v
(Vector r e, Vector r e) -> m (Vector r e, Vector r e)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector r e
l, Sz1 -> Vector r e -> Vector r e
forall r e. Source r Int e => Sz1 -> Vector r e -> Vector r e
unsafeDrop Sz1
k Vector r e
v)
{-# INLINE sliceAtM #-}
sempty :: Vector DS e
sempty :: Vector DS e
sempty = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray Steps Id e
forall (m :: * -> *) e. Monad m => Steps m e
S.empty
{-# INLINE sempty #-}
ssingleton :: e -> Vector DS e
ssingleton :: e -> Vector DS e
ssingleton = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e)
-> (e -> Steps Id e) -> e -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> Steps Id e
forall (m :: * -> *) e. Monad m => e -> Steps m e
S.singleton
{-# INLINE ssingleton #-}
cons :: Load r Ix1 e => e -> Vector r e -> Vector DL e
cons :: e -> Vector r e -> Vector DL e
cons e
e Vector r e
v =
let dv :: Vector DL e
dv = Vector r e -> Vector DL e
forall r ix e. Load r ix e => Array r ix e -> Array DL ix e
toLoadArray Vector r e
v
load :: Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
load Scheduler m ()
scheduler Int
startAt Int -> e -> m ()
uWrite Int -> Sz1 -> e -> m ()
uSet =
Int -> e -> m ()
uWrite Int
startAt e
e m () -> m () -> m ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Vector DL e
-> Scheduler m ()
-> Int
-> (Int -> e -> m ())
-> (Int -> Sz1 -> e -> m ())
-> m ()
forall ix e.
Array DL ix e
-> forall (m :: * -> *).
Monad m =>
Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
dlLoad Vector DL e
dv Scheduler m ()
scheduler (Int
startAt Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) Int -> e -> m ()
uWrite Int -> Sz1 -> e -> m ()
uSet
{-# INLINE load #-}
in Vector DL e
R:ArrayDLixe Int e
dv {dlSize :: Sz1
dlSize = Int -> Sz1
forall ix. ix -> Sz ix
SafeSz (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Sz1 -> Int
forall ix. Sz ix -> ix
unSz (Vector DL e -> Sz1
forall ix e. Array DL ix e -> Sz ix
dlSize Vector DL e
dv)), dlLoad :: forall (m :: * -> *).
Monad m =>
Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
dlLoad = forall (m :: * -> *).
Monad m =>
Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
load}
{-# INLINE cons #-}
snoc :: Load r Ix1 e => Vector r e -> e -> Vector DL e
snoc :: Vector r e -> e -> Vector DL e
snoc Vector r e
v e
e =
let dv :: Vector DL e
dv = Vector r e -> Vector DL e
forall r ix e. Load r ix e => Array r ix e -> Array DL ix e
toLoadArray Vector r e
v
!k :: Int
k = Sz1 -> Int
forall ix. Sz ix -> ix
unSz (Vector DL e -> Sz1
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Vector DL e
dv)
load :: Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
load Scheduler m ()
scheduler Int
startAt Int -> e -> m ()
uWrite Int -> Sz1 -> e -> m ()
uSet =
Vector DL e
-> Scheduler m ()
-> Int
-> (Int -> e -> m ())
-> (Int -> Sz1 -> e -> m ())
-> m ()
forall ix e.
Array DL ix e
-> forall (m :: * -> *).
Monad m =>
Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
dlLoad Vector DL e
dv Scheduler m ()
scheduler Int
startAt Int -> e -> m ()
uWrite Int -> Sz1 -> e -> m ()
uSet m () -> m () -> m ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Int -> e -> m ()
uWrite (Int
k Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
startAt) e
e
{-# INLINE load #-}
in Vector DL e
R:ArrayDLixe Int e
dv {dlSize :: Sz1
dlSize = Int -> Sz1
forall ix. ix -> Sz ix
SafeSz (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
k), dlLoad :: forall (m :: * -> *).
Monad m =>
Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
dlLoad = forall (m :: * -> *).
Monad m =>
Scheduler m ()
-> Int -> (Int -> e -> m ()) -> (Int -> Sz1 -> e -> m ()) -> m ()
load}
{-# INLINE snoc #-}
sreplicate :: Sz1 -> e -> Vector DS e
sreplicate :: Sz1 -> e -> Vector DS e
sreplicate (Sz Int
n) = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e)
-> (e -> Steps Id e) -> e -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> e -> Steps Id e
forall (m :: * -> *) a. Monad m => Int -> a -> Steps m a
S.replicate Int
n
{-# INLINE sreplicate #-}
generate :: Comp -> Sz1 -> (Ix1 -> e) -> Vector D e
generate :: Comp -> Sz1 -> (Int -> e) -> Vector D e
generate = Comp -> Sz1 -> (Int -> e) -> Vector D e
forall r ix e.
Construct r ix e =>
Comp -> Sz ix -> (Int -> e) -> Array r ix e
makeArrayLinear
{-# INLINE generate #-}
sgenerate :: Sz1 -> (Ix1 -> e) -> Vector DS e
sgenerate :: Sz1 -> (Int -> e) -> Vector DS e
sgenerate (Sz Int
n) = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e)
-> ((Int -> e) -> Steps Id e) -> (Int -> e) -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> (Int -> e) -> Steps Id e
forall (m :: * -> *) e. Monad m => Int -> (Int -> e) -> Steps m e
S.generate Int
n
{-# INLINE sgenerate #-}
siterate :: (e -> e) -> e -> Vector DS e
siterate :: (e -> e) -> e -> Vector DS e
siterate e -> e
f = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e)
-> (e -> Steps Id e) -> e -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Maybe (e, e)) -> e -> Steps Id e
forall (m :: * -> *) s e.
Monad m =>
(s -> Maybe (e, s)) -> s -> Steps m e
S.unfoldr (\e
a -> (e, e) -> Maybe (e, e)
forall a. a -> Maybe a
Just (e
a, e -> e
f e
a))
{-# INLINE siterate #-}
siterateN :: Sz1 -> (e -> e) -> e -> Vector DS e
siterateN :: Sz1 -> (e -> e) -> e -> Vector DS e
siterateN Sz1
n e -> e
f e
a = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e) -> Steps Id e -> Vector DS e
forall a b. (a -> b) -> a -> b
$ Int -> (e -> e) -> e -> Steps Id e
forall (m :: * -> *) a.
Monad m =>
Int -> (a -> a) -> a -> Steps m a
S.iterateN (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) e -> e
f e
a
{-# INLINE siterateN #-}
sreplicateM :: Monad m => Sz1 -> m e -> m (Vector DS e)
sreplicateM :: Sz1 -> m e -> m (Vector DS e)
sreplicateM Sz1
n m e
f = Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e)) -> Steps m e -> m (Vector DS e)
forall a b. (a -> b) -> a -> b
$ Int -> m e -> Steps m e
forall (m :: * -> *) a. Monad m => Int -> m a -> Steps m a
S.replicateM (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) m e
f
{-# INLINE sreplicateM #-}
sgenerateM :: Monad m => Sz1 -> (Ix1 -> m e) -> m (Vector DS e)
sgenerateM :: Sz1 -> (Int -> m e) -> m (Vector DS e)
sgenerateM Sz1
n Int -> m e
f = Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e)) -> Steps m e -> m (Vector DS e)
forall a b. (a -> b) -> a -> b
$ Int -> (Int -> m e) -> Steps m e
forall (m :: * -> *) a. Monad m => Int -> (Int -> m a) -> Steps m a
S.generateM (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) Int -> m e
f
{-# INLINE sgenerateM #-}
siterateNM :: Monad m => Sz1 -> (e -> m e) -> e -> m (Vector DS e)
siterateNM :: Sz1 -> (e -> m e) -> e -> m (Vector DS e)
siterateNM Sz1
n e -> m e
f e
a = Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e)) -> Steps m e -> m (Vector DS e)
forall a b. (a -> b) -> a -> b
$ Int -> (e -> m e) -> e -> Steps m e
forall (m :: * -> *) a.
Monad m =>
Int -> (a -> m a) -> a -> Steps m a
S.iterateNM (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) e -> m e
f e
a
{-# INLINE siterateNM #-}
sunfoldr :: (s -> Maybe (e, s)) -> s -> Vector DS e
sunfoldr :: (s -> Maybe (e, s)) -> s -> Vector DS e
sunfoldr s -> Maybe (e, s)
f = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e)
-> (s -> Steps Id e) -> s -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (s -> Maybe (e, s)) -> s -> Steps Id e
forall (m :: * -> *) s e.
Monad m =>
(s -> Maybe (e, s)) -> s -> Steps m e
S.unfoldr s -> Maybe (e, s)
f
{-# INLINE sunfoldr #-}
sunfoldrN ::
Sz1
-> (s -> Maybe (e, s))
-> s
-> Vector DS e
sunfoldrN :: Sz1 -> (s -> Maybe (e, s)) -> s -> Vector DS e
sunfoldrN (Sz Int
n) s -> Maybe (e, s)
f = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e)
-> (s -> Steps Id e) -> s -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> (s -> Maybe (e, s)) -> s -> Steps Id e
forall (m :: * -> *) s e.
Monad m =>
Int -> (s -> Maybe (e, s)) -> s -> Steps m e
S.unfoldrN Int
n s -> Maybe (e, s)
f
{-# INLINE sunfoldrN #-}
sunfoldrM :: Monad m => (s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrM :: (s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrM s -> m (Maybe (e, s))
f = Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e))
-> (s -> Steps m e) -> s -> m (Vector DS e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (s -> m (Maybe (e, s))) -> s -> Steps m e
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 :: Monad m => Sz1 -> (s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrNM :: Sz1 -> (s -> m (Maybe (e, s))) -> s -> m (Vector DS e)
sunfoldrNM (Sz Int
n) s -> m (Maybe (e, s))
f = Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e))
-> (s -> Steps m e) -> s -> m (Vector DS e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> (s -> m (Maybe (e, s))) -> s -> Steps m e
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 :: Sz1 -> (s -> (e, s)) -> s -> Vector DS e
sunfoldrExactN :: Sz1 -> (s -> (e, s)) -> s -> Vector DS e
sunfoldrExactN (Sz Int
n) s -> (e, s)
f = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e)
-> (s -> Steps Id e) -> s -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> (s -> (e, s)) -> s -> Steps Id e
forall (m :: * -> *) s a.
Monad m =>
Int -> (s -> (a, s)) -> s -> Steps m a
S.unfoldrExactN Int
n s -> (e, s)
f
{-# INLINE sunfoldrExactN #-}
sunfoldrExactNM :: Monad m => Sz1 -> (s -> m (e, s)) -> s -> m (Vector DS e)
sunfoldrExactNM :: Sz1 -> (s -> m (e, s)) -> s -> m (Vector DS e)
sunfoldrExactNM (Sz Int
n) s -> m (e, s)
f = Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e))
-> (s -> Steps m e) -> s -> m (Vector DS e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> (s -> m (e, s)) -> s -> Steps m e
forall (m :: * -> *) s a.
Monad m =>
Int -> (s -> m (a, s)) -> s -> Steps m a
S.unfoldrExactNM Int
n s -> m (e, s)
f
{-# INLINE sunfoldrExactNM #-}
senumFromN ::
Num e
=> e
-> Sz1
-> Vector DS e
senumFromN :: e -> Sz1 -> Vector DS e
senumFromN e
x (Sz Int
n) = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e) -> Steps Id e -> Vector DS e
forall a b. (a -> b) -> a -> b
$ e -> e -> Int -> Steps Id e
forall a (m :: * -> *).
(Num a, Monad m) =>
a -> a -> Int -> Steps m a
S.enumFromStepN e
x e
1 Int
n
{-# INLINE senumFromN #-}
senumFromStepN ::
Num e
=> e
-> e
-> Sz1
-> Vector DS e
senumFromStepN :: e -> e -> Sz1 -> Vector DS e
senumFromStepN e
x e
step (Sz Int
n) = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e) -> Steps Id e -> Vector DS e
forall a b. (a -> b) -> a -> b
$ e -> e -> Int -> Steps Id e
forall a (m :: * -> *).
(Num a, Monad m) =>
a -> a -> Int -> Steps m a
S.enumFromStepN e
x e
step Int
n
{-# INLINE senumFromStepN #-}
sappend :: (Stream r1 Ix1 e, Stream r2 Ix1 e) => Vector r1 e -> Vector r2 e -> Vector DS e
sappend :: Vector r1 e -> Vector r2 e -> Vector DS e
sappend Vector r1 e
a1 Vector r2 e
a2 = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Vector r1 e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Vector r1 e
a1 Steps Id e -> Steps Id e -> Steps Id e
forall (m :: * -> *) e.
Monad m =>
Steps m e -> Steps m e -> Steps m e
`S.append` Vector r2 e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Vector r2 e
a2)
{-# INLINE sappend #-}
sconcat :: Stream r Ix1 e => [Vector r e] -> Vector DS e
sconcat :: [Vector r e] -> Vector DS e
sconcat = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e)
-> ([Vector r e] -> Steps Id e) -> [Vector r e] -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Vector r e -> Steps Id e) -> [Vector r e] -> Steps Id e
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Vector r e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sconcat #-}
sfromList :: [e] -> Vector DS e
sfromList :: [e] -> Vector DS e
sfromList = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e)
-> ([e] -> Steps Id e) -> [e] -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [e] -> Steps Id e
forall (m :: * -> *) e. Monad m => [e] -> Steps m e
S.fromList
{-# INLINE sfromList #-}
sfromListN :: Sz1 -> [e] -> Vector DS e
sfromListN :: Sz1 -> [e] -> Vector DS e
sfromListN (Sz Int
n) = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e)
-> ([e] -> Steps Id e) -> [e] -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> [e] -> Steps Id e
forall (m :: * -> *) e. Monad m => Int -> [e] -> Steps m e
S.fromListN Int
n
{-# INLINE sfromListN #-}
stoList :: Stream r ix e => Array r ix e -> [e]
stoList :: Array r ix e -> [e]
stoList = Steps Id e -> [e]
forall e. Steps Id e -> [e]
S.toList (Steps Id e -> [e])
-> (Array r ix e -> Steps Id e) -> Array r ix e -> [e]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE stoList #-}
sfilter :: S.Stream r ix e => (e -> Bool) -> Array r ix e -> Vector DS e
sfilter :: (e -> Bool) -> Array r ix e -> Vector DS e
sfilter e -> Bool
f = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Vector DS e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Bool) -> Steps Id e -> Steps Id e
forall (m :: * -> *) a.
Monad m =>
(a -> Bool) -> Steps m a -> Steps m a
S.filter e -> Bool
f (Steps Id e -> Steps Id e)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Steps Id e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE sfilter #-}
sifilter :: Stream r ix a => (ix -> a -> Bool) -> Array r ix a -> Vector DS a
sifilter :: (ix -> a -> Bool) -> Array r ix a -> Vector DS a
sifilter ix -> a -> Bool
f =
(ix -> a -> Maybe a) -> Array r ix a -> Vector DS a
forall r ix a b.
Stream r ix a =>
(ix -> a -> Maybe b) -> Array r ix a -> Vector DS b
simapMaybe ((ix -> a -> Maybe a) -> Array r ix a -> Vector DS a)
-> (ix -> a -> Maybe a) -> Array r ix a -> Vector DS a
forall a b. (a -> b) -> a -> b
$ \ix
ix a
e ->
if ix -> a -> Bool
f ix
ix a
e
then a -> Maybe a
forall a. a -> Maybe a
Just a
e
else Maybe a
forall a. Maybe a
Nothing
{-# INLINE sifilter #-}
sfilterM :: (S.Stream r ix e, Applicative f) => (e -> f Bool) -> Array r ix e -> f (Vector DS e)
sfilterM :: (e -> f Bool) -> Array r ix e -> f (Vector DS e)
sfilterM e -> f Bool
f Array r ix e
arr = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e) -> f (Steps Id e) -> f (Vector DS e)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (e -> f Bool) -> Steps Id e -> f (Steps Id e)
forall (m :: * -> *) (f :: * -> *) e.
(Monad m, Applicative f) =>
(e -> f Bool) -> Steps Id e -> f (Steps m e)
S.filterA e -> f Bool
f (Array r ix e -> Steps Id e
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 ::
(Stream r ix a, Applicative f) => (ix -> a -> f Bool) -> Array r ix a -> f (Vector DS a)
sifilterM :: (ix -> a -> f Bool) -> Array r ix a -> f (Vector DS a)
sifilterM ix -> a -> f Bool
f =
(ix -> a -> f (Maybe a)) -> Array r ix a -> f (Vector DS a)
forall r ix a (f :: * -> *) b.
(Stream r ix a, Applicative f) =>
(ix -> a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
simapMaybeM ((ix -> a -> f (Maybe a)) -> Array r ix a -> f (Vector DS a))
-> (ix -> a -> f (Maybe a)) -> Array r ix a -> f (Vector DS a)
forall a b. (a -> b) -> a -> b
$ \ix
ix a
e ->
(\Bool
p ->
if Bool
p
then a -> Maybe a
forall a. a -> Maybe a
Just a
e
else Maybe a
forall a. Maybe a
Nothing) (Bool -> Maybe a) -> f Bool -> f (Maybe a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
ix -> a -> f Bool
f ix
ix a
e
{-# INLINE sifilterM #-}
smapMaybe :: S.Stream r ix a => (a -> Maybe b) -> Array r ix a -> Vector DS b
smapMaybe :: (a -> Maybe b) -> Array r ix a -> Vector DS b
smapMaybe a -> Maybe b
f = Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id b -> Vector DS b)
-> (Array r ix a -> Steps Id b) -> Array r ix a -> Vector DS b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Maybe b) -> Steps Id a -> Steps Id b
forall (m :: * -> *) a e.
Monad m =>
(a -> Maybe e) -> Steps m a -> Steps m e
S.mapMaybe a -> Maybe b
f (Steps Id a -> Steps Id b)
-> (Array r ix a -> Steps Id a) -> Array r ix a -> Steps Id b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapMaybe #-}
simapMaybe :: Stream r ix a => (ix -> a -> Maybe b) -> Array r ix a -> Vector DS b
simapMaybe :: (ix -> a -> Maybe b) -> Array r ix a -> Vector DS b
simapMaybe ix -> a -> Maybe b
f = Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id b -> Vector DS b)
-> (Array r ix a -> Steps Id b) -> Array r ix a -> Vector DS b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((ix, a) -> Maybe b) -> Steps Id (ix, a) -> Steps Id b
forall (m :: * -> *) a e.
Monad m =>
(a -> Maybe e) -> Steps m a -> Steps m e
S.mapMaybe ((ix -> a -> Maybe b) -> (ix, a) -> Maybe b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> Maybe b
f) (Steps Id (ix, a) -> Steps Id b)
-> (Array r ix a -> Steps Id (ix, a)) -> Array r ix a -> Steps Id b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id (ix, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE simapMaybe #-}
simapMaybeM ::
(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)) -> Array r ix a -> f (Vector DS b)
simapMaybeM ix -> a -> f (Maybe b)
f = (Steps Id b -> Vector DS b) -> f (Steps Id b) -> f (Vector DS b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
DSArray (f (Steps Id b) -> f (Vector DS b))
-> (Array r ix a -> f (Steps Id b))
-> Array r ix a
-> f (Vector DS b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((ix, a) -> f (Maybe b)) -> Steps Id (ix, a) -> f (Steps Id b)
forall (m :: * -> *) (f :: * -> *) a e.
(Monad m, Applicative f) =>
(a -> f (Maybe e)) -> Steps Id a -> f (Steps m e)
S.mapMaybeA ((ix -> a -> f (Maybe b)) -> (ix, a) -> f (Maybe b)
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> f (Maybe b)
f) (Steps Id (ix, a) -> f (Steps Id b))
-> (Array r ix a -> Steps Id (ix, a))
-> Array r ix a
-> f (Steps Id b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id (ix, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE simapMaybeM #-}
scatMaybes :: S.Stream r ix (Maybe a) => Array r ix (Maybe a) -> Vector DS a
scatMaybes :: Array r ix (Maybe a) -> Vector DS a
scatMaybes = (Maybe a -> Maybe a) -> Array r ix (Maybe a) -> Vector DS a
forall r ix a b.
Stream r ix a =>
(a -> Maybe b) -> Array r ix a -> Vector DS b
smapMaybe Maybe a -> Maybe a
forall a. a -> a
id
{-# INLINE scatMaybes #-}
smapMaybeM ::
(S.Stream r ix a, Applicative f) => (a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
smapMaybeM :: (a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
smapMaybeM a -> f (Maybe b)
f = (Steps Id b -> Vector DS b) -> f (Steps Id b) -> f (Vector DS b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
DSArray (f (Steps Id b) -> f (Vector DS b))
-> (Array r ix a -> f (Steps Id b))
-> Array r ix a
-> f (Vector DS b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f (Maybe b)) -> Steps Id a -> f (Steps Id b)
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 (Steps Id a -> f (Steps Id b))
-> (Array r ix a -> Steps Id a) -> Array r ix a -> f (Steps Id b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapMaybeM #-}
smap :: S.Stream r ix a => (a -> b) -> Array r ix a -> Vector DS b
smap :: (a -> b) -> Array r ix a -> Vector DS b
smap a -> b
f = Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id b -> Vector DS b)
-> (Array r ix a -> Steps Id b) -> Array r ix a -> Vector DS b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> Steps Id a -> Steps Id b
forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map a -> b
f (Steps Id a -> Steps Id b)
-> (Array r ix a -> Steps Id a) -> Array r ix a -> Steps Id b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smap #-}
simap :: S.Stream r ix a => (ix -> a -> b) -> Array r ix a -> Vector DS b
simap :: (ix -> a -> b) -> Array r ix a -> Vector DS b
simap ix -> a -> b
f = Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id b -> Vector DS b)
-> (Array r ix a -> Steps Id b) -> Array r ix a -> Vector DS b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((ix, a) -> b) -> Steps Id (ix, a) -> Steps Id b
forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map ((ix -> a -> b) -> (ix, a) -> b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> b
f) (Steps Id (ix, a) -> Steps Id b)
-> (Array r ix a -> Steps Id (ix, a)) -> Array r ix a -> Steps Id b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id (ix, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE simap #-}
straverse :: (S.Stream r ix a, Applicative f) => (a -> f b) -> Array r ix a -> f (Vector DS b)
straverse :: (a -> f b) -> Array r ix a -> f (Vector DS b)
straverse a -> f b
f = (Steps Id b -> Vector DS b) -> f (Steps Id b) -> f (Vector DS b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
fromSteps (f (Steps Id b) -> f (Vector DS b))
-> (Array r ix a -> f (Steps Id b))
-> Array r ix a
-> f (Vector DS b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f b) -> Steps Id a -> f (Steps Id b)
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 (Steps Id a -> f (Steps Id b))
-> (Array r ix a -> Steps Id a) -> Array r ix a -> f (Steps Id b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE straverse #-}
sitraverse :: (S.Stream r ix a, Applicative f) => (ix -> a -> f b) -> Array r ix a -> f (Vector DS b)
sitraverse :: (ix -> a -> f b) -> Array r ix a -> f (Vector DS b)
sitraverse ix -> a -> f b
f = (Steps Id b -> Vector DS b) -> f (Steps Id b) -> f (Vector DS b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Steps Id b -> Vector DS b
forall e. Steps Id e -> Array DS Int e
fromSteps (f (Steps Id b) -> f (Vector DS b))
-> (Array r ix a -> f (Steps Id b))
-> Array r ix a
-> f (Vector DS b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((ix, a) -> f b) -> Steps Id (ix, a) -> f (Steps Id b)
forall (m :: * -> *) (f :: * -> *) e a.
(Monad m, Applicative f) =>
(e -> f a) -> Steps Id e -> f (Steps m a)
S.traverse ((ix -> a -> f b) -> (ix, a) -> f b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> f b
f) (Steps Id (ix, a) -> f (Steps Id b))
-> (Array r ix a -> Steps Id (ix, a))
-> Array r ix a
-> f (Steps Id b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id (ix, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE sitraverse #-}
smapM :: (S.Stream r ix a, Monad m) => (a -> m b) -> Array r ix a -> m (Vector DS b)
smapM :: (a -> m b) -> Array r ix a -> m (Vector DS b)
smapM a -> m b
f = Steps m b -> m (Vector DS b)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m b -> m (Vector DS b))
-> (Array r ix a -> Steps m b) -> Array r ix a -> m (Vector DS b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> m b) -> Steps m a -> Steps m b
forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> Steps m a
S.mapM a -> m b
f (Steps m a -> Steps m b)
-> (Array r ix a -> Steps m a) -> Array r ix a -> Steps m b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id a -> Steps m a
forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId (Steps Id a -> Steps m a)
-> (Array r ix a -> Steps Id a) -> Array r ix a -> Steps m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapM #-}
simapM :: (S.Stream r ix a, Monad m) => (ix -> a -> m b) -> Array r ix a -> m (Vector DS b)
simapM :: (ix -> a -> m b) -> Array r ix a -> m (Vector DS b)
simapM ix -> a -> m b
f = Steps m b -> m (Vector DS b)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m b -> m (Vector DS b))
-> (Array r ix a -> Steps m b) -> Array r ix a -> m (Vector DS b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((ix, a) -> m b) -> Steps m (ix, a) -> Steps m b
forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> Steps m a
S.mapM ((ix -> a -> m b) -> (ix, a) -> m b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> m b
f) (Steps m (ix, a) -> Steps m b)
-> (Array r ix a -> Steps m (ix, a)) -> Array r ix a -> Steps m b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id (ix, a) -> Steps m (ix, a)
forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId (Steps Id (ix, a) -> Steps m (ix, a))
-> (Array r ix a -> Steps Id (ix, a))
-> Array r ix a
-> Steps m (ix, a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id (ix, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE simapM #-}
smapM_ :: (S.Stream r ix a, Monad m) => (a -> m b) -> Array r ix a -> m ()
smapM_ :: (a -> m b) -> Array r ix a -> m ()
smapM_ a -> m b
f = (a -> m b) -> Steps m a -> m ()
forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> m ()
S.mapM_ a -> m b
f (Steps m a -> m ())
-> (Array r ix a -> Steps m a) -> Array r ix a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id a -> Steps m a
forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId (Steps Id a -> Steps m a)
-> (Array r ix a -> Steps Id a) -> Array r ix a -> Steps m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE smapM_ #-}
simapM_ :: (S.Stream r ix a, Monad m) => (ix -> a -> m b) -> Array r ix a -> m ()
simapM_ :: (ix -> a -> m b) -> Array r ix a -> m ()
simapM_ ix -> a -> m b
f = ((ix, a) -> m b) -> Steps m (ix, a) -> m ()
forall (m :: * -> *) e a.
Monad m =>
(e -> m a) -> Steps m e -> m ()
S.mapM_ ((ix -> a -> m b) -> (ix, a) -> m b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> m b
f) (Steps m (ix, a) -> m ())
-> (Array r ix a -> Steps m (ix, a)) -> Array r ix a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id (ix, a) -> Steps m (ix, a)
forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId (Steps Id (ix, a) -> Steps m (ix, a))
-> (Array r ix a -> Steps Id (ix, a))
-> Array r ix a
-> Steps m (ix, a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix a -> Steps Id (ix, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx
{-# INLINE simapM_ #-}
sforM :: (S.Stream r ix a, Monad m) => Array r ix a -> (a -> m b) -> m (Vector DS b)
sforM :: Array r ix a -> (a -> m b) -> m (Vector DS b)
sforM = ((a -> m b) -> Array r ix a -> m (Vector DS b))
-> Array r ix a -> (a -> m b) -> m (Vector DS b)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (a -> m b) -> Array r ix a -> m (Vector DS b)
forall r ix a (m :: * -> *) b.
(Stream r ix a, Monad m) =>
(a -> m b) -> Array r ix a -> m (Vector DS b)
smapM
{-# INLINE sforM #-}
siforM :: (S.Stream r ix a, Monad m) => Array r ix a -> (ix -> a -> m b) -> m (Vector DS b)
siforM :: Array r ix a -> (ix -> a -> m b) -> m (Vector DS b)
siforM = ((ix -> a -> m b) -> Array r ix a -> m (Vector DS b))
-> Array r ix a -> (ix -> a -> m b) -> m (Vector DS b)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ix -> a -> m b) -> Array r ix a -> m (Vector DS b)
forall r ix a (m :: * -> *) b.
(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_ :: Array r ix a -> (a -> m b) -> m ()
sforM_ = ((a -> m b) -> Array r ix a -> m ())
-> Array r ix a -> (a -> m b) -> m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip (a -> m b) -> Array r ix a -> m ()
forall r ix a (m :: * -> *) b.
(Stream r ix a, Monad m) =>
(a -> m b) -> Array r ix a -> m ()
smapM_
{-# INLINE sforM_ #-}
siforM_ :: (S.Stream r ix a, Monad m) => Array r ix a -> (ix -> a -> m b) -> m ()
siforM_ :: Array r ix a -> (ix -> a -> m b) -> m ()
siforM_ = ((ix -> a -> m b) -> Array r ix a -> m ())
-> Array r ix a -> (ix -> a -> m b) -> m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip (ix -> a -> m b) -> Array r ix a -> m ()
forall r ix a (m :: * -> *) b.
(Stream r ix a, Monad m) =>
(ix -> a -> m b) -> Array r ix a -> m ()
simapM_
{-# INLINE siforM_ #-}
szip ::
(S.Stream ra Ix1 a, S.Stream rb Ix1 b) => Vector ra a -> Vector rb b -> Vector DS (a, b)
szip :: Vector ra a -> Vector rb b -> Vector DS (a, b)
szip = (a -> b -> (a, b))
-> Vector ra a -> Vector rb b -> Vector DS (a, b)
forall ra a rb 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 ::
(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 :: Vector ra a -> Vector rb b -> Vector rc c -> Vector DS (a, b, c)
szip3 = (a -> b -> c -> (a, b, c))
-> Vector ra a -> Vector rb b -> Vector rc c -> Vector DS (a, b, c)
forall ra a rb b rc 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 ::
(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 :: Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS (a, b, c, d)
szip4 = (a -> b -> c -> d -> (a, b, c, d))
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector DS (a, b, c, d)
forall ra a rb b rc c rd 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 ::
(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 :: Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS (a, b, c, d, e)
szip5 = (a -> b -> c -> d -> e -> (a, b, c, d, e))
-> Vector ra a
-> Vector rb b
-> Vector rc c
-> Vector rd d
-> Vector re e
-> Vector DS (a, b, c, d, e)
forall ra a rb b rc c rd d re 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 ::
( 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 :: 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 = (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, 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)
forall ra a rb b rc c rd d re e rf 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 ::
(S.Stream ra Ix1 a, S.Stream rb Ix1 b)
=> (a -> b -> c)
-> Vector ra a
-> Vector rb b
-> Vector DS c
szipWith :: (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 = Steps Id c -> Vector DS c
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id c -> Vector DS c) -> Steps Id c -> Vector DS c
forall a b. (a -> b) -> a -> b
$ (a -> b -> c) -> Steps Id a -> Steps Id b -> Steps Id c
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 (Vector ra a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
{-# INLINE szipWith #-}
szipWith3 ::
(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 :: (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 = Steps Id d -> Vector DS d
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id d -> Vector DS d) -> Steps Id d -> Vector DS d
forall a b. (a -> b) -> a -> b
$ (a -> b -> c -> d)
-> Steps Id a -> Steps Id b -> Steps Id c -> Steps Id d
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 (Vector ra a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
{-# INLINE szipWith3 #-}
szipWith4 ::
(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 :: (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 =
Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e) -> Steps Id e -> Vector DS e
forall a b. (a -> b) -> a -> b
$ (a -> b -> c -> d -> e)
-> Steps Id a
-> Steps Id b
-> Steps Id c
-> Steps Id d
-> Steps Id e
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 (Vector ra a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3) (Vector rd d -> Steps Id d
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
{-# INLINE szipWith4 #-}
szipWith5 ::
(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 :: (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 =
Steps Id f -> Vector DS f
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id f -> Vector DS f) -> Steps Id f -> Vector DS f
forall a b. (a -> b) -> a -> b
$
(a -> b -> c -> d -> e -> f)
-> Steps Id a
-> Steps Id b
-> Steps Id c
-> Steps Id d
-> Steps Id e
-> Steps Id f
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 (Vector ra a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1) (Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3) (Vector rd d -> Steps Id d
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4) (Vector re e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
{-# INLINE szipWith5 #-}
szipWith6 ::
( 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 :: (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 =
Steps Id g -> Vector DS g
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id g -> Vector DS g) -> Steps Id g -> Vector DS g
forall a b. (a -> b) -> a -> b
$
(a -> b -> c -> d -> e -> f -> g)
-> Steps Id a
-> Steps Id b
-> Steps Id c
-> Steps Id d
-> Steps Id e
-> Steps Id f
-> Steps Id g
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
(Vector ra a -> Steps Id a
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector ra a
v1)
(Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
(Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
(Vector rd d -> Steps Id d
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
(Vector re e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
(Vector rf f -> Steps Id f
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rf f
v6)
{-# INLINE szipWith6 #-}
sizipWith ::
(S.Stream ra Ix1 a, S.Stream rb Ix1 b)
=> (Ix1 -> a -> b -> c)
-> Vector ra a
-> Vector rb b
-> Vector DS c
sizipWith :: (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 = Steps Id c -> Vector DS c
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id c -> Vector DS c) -> Steps Id c -> Vector DS c
forall a b. (a -> b) -> a -> b
$ ((Int, a) -> b -> c)
-> Steps Id (Int, a) -> Steps Id b -> Steps Id c
forall (m :: * -> *) a b e.
Monad m =>
(a -> b -> e) -> Steps m a -> Steps m b -> Steps m e
S.zipWith ((Int -> a -> b -> c) -> (Int, a) -> b -> c
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c
f) (Vector ra a -> Steps Id (Int, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1) (Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
{-# INLINE sizipWith #-}
sizipWith3 ::
(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 :: (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 =
Steps Id d -> Vector DS d
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id d -> Vector DS d) -> Steps Id d -> Vector DS d
forall a b. (a -> b) -> a -> b
$ ((Int, a) -> b -> c -> d)
-> Steps Id (Int, a) -> Steps Id b -> Steps Id c -> Steps Id d
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 ((Int -> a -> b -> c -> d) -> (Int, a) -> b -> c -> d
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d
f) (Vector ra a -> Steps Id (Int, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1) (Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
{-# INLINE sizipWith3 #-}
sizipWith4 ::
(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 :: (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 =
Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Vector DS e) -> Steps Id e -> Vector DS e
forall a b. (a -> b) -> a -> b
$
((Int, a) -> b -> c -> d -> e)
-> Steps Id (Int, a)
-> Steps Id b
-> Steps Id c
-> Steps Id d
-> Steps Id e
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 ((Int -> a -> b -> c -> d -> e) -> (Int, a) -> b -> c -> d -> e
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e
f) (Vector ra a -> Steps Id (Int, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1) (Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2) (Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3) (Vector rd d -> Steps Id d
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
{-# INLINE sizipWith4 #-}
sizipWith5 ::
(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 :: (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 =
Steps Id f -> Vector DS f
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id f -> Vector DS f) -> Steps Id f -> Vector DS f
forall a b. (a -> b) -> a -> b
$
((Int, a) -> b -> c -> d -> e -> f)
-> Steps Id (Int, a)
-> Steps Id b
-> Steps Id c
-> Steps Id d
-> Steps Id e
-> Steps Id f
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
((Int -> a -> b -> c -> d -> e -> f)
-> (Int, a) -> b -> c -> d -> e -> f
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f
f)
(Vector ra a -> Steps Id (Int, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1)
(Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
(Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
(Vector rd d -> Steps Id d
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
(Vector re e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
{-# INLINE sizipWith5 #-}
sizipWith6 ::
( 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 :: (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 =
Steps Id g -> Vector DS g
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id g -> Vector DS g) -> Steps Id g -> Vector DS g
forall a b. (a -> b) -> a -> b
$
((Int, a) -> b -> c -> d -> e -> f -> g)
-> Steps Id (Int, a)
-> Steps Id b
-> Steps Id c
-> Steps Id d
-> Steps Id e
-> Steps Id f
-> Steps Id g
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
((Int -> a -> b -> c -> d -> e -> f -> g)
-> (Int, a) -> b -> c -> d -> e -> f -> g
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f -> g
f)
(Vector ra a -> Steps Id (Int, a)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
S.toStreamIx Vector ra a
v1)
(Vector rb b -> Steps Id b
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rb b
v2)
(Vector rc c -> Steps Id c
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rc c
v3)
(Vector rd d -> Steps Id d
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rd d
v4)
(Vector re e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector re e
v5)
(Vector rf f -> Steps Id f
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Vector rf f
v6)
{-# INLINE sizipWith6 #-}
szipWithM ::
(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 :: (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 = Steps m c -> m (Vector DS c)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m c -> m (Vector DS c)) -> Steps m c -> m (Vector DS c)
forall a b. (a -> b) -> a -> b
$ (a -> b -> m c) -> Steps m a -> Steps m b -> Steps m c
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
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 ::
(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 :: (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 = Steps m d -> m (Vector DS d)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m d -> m (Vector DS d)) -> Steps m d -> m (Vector DS d)
forall a b. (a -> b) -> a -> b
$ (a -> b -> c -> m d)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
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 ::
(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 :: (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 =
Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e)) -> Steps m e -> m (Vector DS e)
forall a b. (a -> b) -> a -> b
$ (a -> b -> c -> d -> m e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> Steps m e
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (Vector rd d -> Steps m d
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 ::
( 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 :: (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 =
Steps m f -> m (Vector DS f)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m f -> m (Vector DS f)) -> Steps m f -> m (Vector DS f)
forall a b. (a -> b) -> a -> b
$
(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
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4) (Vector re e -> Steps m e
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 ::
( 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 :: (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 =
Steps m g -> m (Vector DS g)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m g -> m (Vector DS g)) -> Steps m g -> m (Vector DS g)
forall a b. (a -> b) -> a -> b
$
(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
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
(Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1)
(Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(Vector re e -> Steps m e
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(Vector rf f -> Steps m f
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 ::
(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 :: (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 = Steps m c -> m (Vector DS c)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m c -> m (Vector DS c)) -> Steps m c -> m (Vector DS c)
forall a b. (a -> b) -> a -> b
$ ((Int, a) -> b -> m c)
-> Steps m (Int, a) -> Steps m b -> Steps m c
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Steps m a -> Steps m b -> Steps m c
S.zipWithM ((Int -> a -> b -> m c) -> (Int, a) -> b -> m c
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> m c
f) (Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (Vector rb b -> Steps m b
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 ::
(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 :: (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 =
Steps m d -> m (Vector DS d)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m d -> m (Vector DS d)) -> Steps m d -> m (Vector DS d)
forall a b. (a -> b) -> a -> b
$ ((Int, a) -> b -> c -> m d)
-> Steps m (Int, a) -> Steps m b -> Steps m c -> Steps m d
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 ((Int -> a -> b -> c -> m d) -> (Int, a) -> b -> c -> m d
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> m d
f) (Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
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 ::
(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 :: (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 =
Steps m e -> m (Vector DS e)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m e -> m (Vector DS e)) -> Steps m e -> m (Vector DS e)
forall a b. (a -> b) -> a -> b
$
((Int, a) -> b -> c -> d -> m e)
-> Steps m (Int, a)
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
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 ((Int -> a -> b -> c -> d -> m e) -> (Int, a) -> b -> c -> d -> m e
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> m e
f) (Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (Vector rd d -> Steps m d
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 ::
( 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 :: (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 =
Steps m f -> m (Vector DS f)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m f -> m (Vector DS f)) -> Steps m f -> m (Vector DS f)
forall a b. (a -> b) -> a -> b
$
((Int, a) -> b -> c -> d -> e -> m f)
-> Steps m (Int, a)
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
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
((Int -> a -> b -> c -> d -> e -> m f)
-> (Int, a) -> b -> c -> d -> e -> m f
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> m f
f)
(Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(Vector re e -> Steps m e
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 ::
( 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 :: (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 =
Steps m g -> m (Vector DS g)
forall (m :: * -> *) e. Monad m => Steps m e -> m (Array DS Int e)
fromStepsM (Steps m g -> m (Vector DS g)) -> Steps m g -> m (Vector DS g)
forall a b. (a -> b) -> a -> b
$
((Int, a) -> b -> c -> d -> e -> f -> m g)
-> Steps m (Int, a)
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> Steps m g
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
((Int -> a -> b -> c -> d -> e -> f -> m g)
-> (Int, a) -> b -> c -> d -> e -> f -> m g
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f -> m g
f)
(Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(Vector re e -> Steps m e
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(Vector rf f -> Steps m f
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_ ::
(S.Stream ra Ix1 a, S.Stream rb Ix1 b, Monad m)
=> (a -> b -> m c)
-> Vector ra a
-> Vector rb b
-> m ()
szipWithM_ :: (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 = (a -> b -> m c) -> Steps m a -> Steps m b -> m ()
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
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_ ::
(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_ :: (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 = (a -> b -> c -> m d) -> Steps m a -> Steps m b -> Steps m c -> m ()
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
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_ ::
(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_ :: (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 =
(a -> b -> c -> d -> m e)
-> Steps m a -> Steps m b -> Steps m c -> Steps m d -> m ()
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (Vector rd d -> Steps m d
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_ ::
( 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_ :: (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 =
(a -> b -> c -> d -> e -> m f)
-> Steps m a
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> m ()
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 (Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4) (Vector re e -> Steps m e
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_ ::
( 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_ :: (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 =
(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 ()
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
(Vector ra a -> Steps m a
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector ra a
v1)
(Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(Vector re e -> Steps m e
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(Vector rf f -> Steps m f
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_ ::
(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_ :: (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 = ((Int, a) -> b -> m c) -> Steps m (Int, a) -> Steps m b -> m ()
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Steps m a -> Steps m b -> m ()
S.zipWithM_ ((Int -> a -> b -> m c) -> (Int, a) -> b -> m c
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> m c
f) (Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (Vector rb b -> Steps m b
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_ ::
(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_ :: (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 = ((Int, a) -> b -> c -> m d)
-> Steps m (Int, a) -> Steps m b -> Steps m c -> m ()
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_ ((Int -> a -> b -> c -> m d) -> (Int, a) -> b -> c -> m d
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> m d
f) (Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
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_ ::
(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_ :: (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 =
((Int, a) -> b -> c -> d -> m e)
-> Steps m (Int, a) -> Steps m b -> Steps m c -> Steps m d -> m ()
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_ ((Int -> a -> b -> c -> d -> m e) -> (Int, a) -> b -> c -> d -> m e
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> m e
f) (Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1) (Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2) (Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3) (Vector rd d -> Steps m d
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_ ::
( 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_ :: (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 =
((Int, a) -> b -> c -> d -> e -> m f)
-> Steps m (Int, a)
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> m ()
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_
((Int -> a -> b -> c -> d -> e -> m f)
-> (Int, a) -> b -> c -> d -> e -> m f
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> m f
f)
(Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(Vector re e -> Steps m e
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_ ::
( 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_ :: (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 =
((Int, a) -> b -> c -> d -> e -> f -> m g)
-> Steps m (Int, a)
-> Steps m b
-> Steps m c
-> Steps m d
-> Steps m e
-> Steps m f
-> m ()
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_
((Int -> a -> b -> c -> d -> e -> f -> m g)
-> (Int, a) -> b -> c -> d -> e -> f -> m g
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Int -> a -> b -> c -> d -> e -> f -> m g
f)
(Vector ra a -> Steps m (Int, a)
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m (ix, e)
toStreamIxM Vector ra a
v1)
(Vector rb b -> Steps m b
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rb b
v2)
(Vector rc c -> Steps m c
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rc c
v3)
(Vector rd d -> Steps m d
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector rd d
v4)
(Vector re e -> Steps m e
forall r ix e (m :: * -> *).
(Stream r ix e, Monad m) =>
Array r ix e -> Steps m e
toStreamM Vector re e
v5)
(Vector rf f -> Steps m f
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 :: Stream r ix e => (a -> e -> a) -> a -> Array r ix e -> a
sfoldl :: (a -> e -> a) -> a -> Array r ix e -> a
sfoldl a -> e -> a
f a
acc = Id a -> a
forall a. Id a -> a
S.unId (Id a -> a) -> (Array r ix e -> Id a) -> Array r ix e -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> e -> a) -> a -> Steps Id e -> Id a
forall (m :: * -> *) b a.
Monad m =>
(b -> a -> b) -> b -> Steps m a -> m b
S.foldl a -> e -> a
f a
acc (Steps Id e -> Id a)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Id a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sfoldl #-}
sfoldlM :: (Stream r ix e, Monad m) => (a -> e -> m a) -> a -> Array r ix e -> m a
sfoldlM :: (a -> e -> m a) -> a -> Array r ix e -> m a
sfoldlM a -> e -> m a
f a
acc = (a -> e -> m a) -> a -> Steps m e -> m a
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 (Steps m e -> m a)
-> (Array r ix e -> Steps m e) -> Array r ix e -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id e -> Steps m e
forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId (Steps Id e -> Steps m e)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Steps m e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sfoldlM #-}
sfoldlM_ :: (Stream r ix e, Monad m) => (a -> e -> m a) -> a -> Array r ix e -> m ()
sfoldlM_ :: (a -> e -> m a) -> a -> Array r ix e -> m ()
sfoldlM_ a -> e -> m a
f a
acc = m a -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (m a -> m ()) -> (Array r ix e -> m a) -> Array r ix e -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> e -> m a) -> a -> Array r ix e -> m a
forall r ix e (m :: * -> *) a.
(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' :: Stream r ix e => (e -> e -> e) -> Array r ix e -> e
sfoldl1' :: (e -> e -> e) -> Array r ix e -> e
sfoldl1' e -> e -> e
f = (SomeException -> e) -> (e -> e) -> Either SomeException e -> e
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either SomeException -> e
forall a e. Exception e => e -> a
throw e -> e
forall a. a -> a
id (Either SomeException e -> e)
-> (Array r ix e -> Either SomeException e) -> Array r ix e -> e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> e -> Either SomeException e)
-> Array r ix e -> Either SomeException e
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 -> Either SomeException e
forall (f :: * -> *) a. Applicative f => a -> f a
pure (e -> Either SomeException e)
-> (e -> e) -> e -> Either SomeException e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> e -> e
f e
e)
{-# INLINE sfoldl1' #-}
sfoldl1M :: (Stream r ix e, MonadThrow m) => (e -> e -> m e) -> Array r ix e -> m e
sfoldl1M :: (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 = Steps Id e -> Steps m e
forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId (Steps Id e -> Steps m e) -> Steps Id e -> Steps m e
forall a b. (a -> b) -> a -> b
$ Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream Array r ix e
arr
Bool
nullStream <- Steps m e -> m Bool
forall (m :: * -> *) a. Monad m => Steps m a -> m Bool
S.null Steps m e
str
Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
nullStream (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ SizeException -> m ()
forall (m :: * -> *) e a. (MonadThrow m, Exception e) => e -> m a
throwM (SizeException -> m ()) -> SizeException -> m ()
forall a b. (a -> b) -> a -> b
$ Sz ix -> SizeException
forall ix. Index ix => Sz ix -> SizeException
SizeEmptyException (Array r ix e -> Sz ix
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Array r ix e
arr)
(e -> e -> m e) -> Steps m e -> m e
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_ :: (Stream r ix e, MonadThrow m) => (e -> e -> m e) -> Array r ix e -> m ()
sfoldl1M_ :: (e -> e -> m e) -> Array r ix e -> m ()
sfoldl1M_ e -> e -> m e
f = m e -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (m e -> m ()) -> (Array r ix e -> m e) -> Array r ix e -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> e -> m e) -> Array r ix e -> m e
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 :: Stream r ix e => (a -> ix -> e -> a) -> a -> Array r ix e -> a
sifoldl :: (a -> ix -> e -> a) -> a -> Array r ix e -> a
sifoldl a -> ix -> e -> a
f a
acc = Id a -> a
forall a. Id a -> a
S.unId (Id a -> a) -> (Array r ix e -> Id a) -> Array r ix e -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> (ix, e) -> a) -> a -> Steps Id (ix, e) -> Id a
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 (Steps Id (ix, e) -> Id a)
-> (Array r ix e -> Steps Id (ix, e)) -> Array r ix e -> Id a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id (ix, e)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE sifoldl #-}
sifoldlM :: (Stream r ix e, Monad m) => (a -> ix -> e -> m a) -> a -> Array r ix e -> m a
sifoldlM :: (a -> ix -> e -> m a) -> a -> Array r ix e -> m a
sifoldlM a -> ix -> e -> m a
f a
acc = (a -> (ix, e) -> m a) -> a -> Steps m (ix, e) -> m a
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 (Steps m (ix, e) -> m a)
-> (Array r ix e -> Steps m (ix, e)) -> Array r ix e -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id (ix, e) -> Steps m (ix, e)
forall (m :: * -> *) e. Monad m => Steps Id e -> Steps m e
S.transStepsId (Steps Id (ix, e) -> Steps m (ix, e))
-> (Array r ix e -> Steps Id (ix, e))
-> Array r ix e
-> Steps m (ix, e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id (ix, e)
forall r ix e. Stream r ix e => Array r ix e -> Steps Id (ix, e)
toStreamIx
{-# INLINE sifoldlM #-}
sifoldlM_ :: (Stream r ix e, Monad m) => (a -> ix -> e -> m a) -> a -> Array r ix e -> m ()
sifoldlM_ :: (a -> ix -> e -> m a) -> a -> Array r ix e -> m ()
sifoldlM_ a -> ix -> e -> m a
f a
acc = m a -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (m a -> m ()) -> (Array r ix e -> m a) -> Array r ix e -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> ix -> e -> m a) -> a -> Array r ix e -> m a
forall r ix e (m :: * -> *) a.
(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 :: Stream r ix Bool => Array r ix Bool -> Bool
sor :: Array r ix Bool -> Bool
sor = Id Bool -> Bool
forall a. Id a -> a
S.unId (Id Bool -> Bool)
-> (Array r ix Bool -> Id Bool) -> Array r ix Bool -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id Bool -> Id Bool
forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.or (Steps Id Bool -> Id Bool)
-> (Array r ix Bool -> Steps Id Bool) -> Array r ix Bool -> Id Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix Bool -> Steps Id Bool
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sor #-}
sand :: Stream r ix Bool => Array r ix Bool -> Bool
sand :: Array r ix Bool -> Bool
sand = Id Bool -> Bool
forall a. Id a -> a
S.unId (Id Bool -> Bool)
-> (Array r ix Bool -> Id Bool) -> Array r ix Bool -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id Bool -> Id Bool
forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.and (Steps Id Bool -> Id Bool)
-> (Array r ix Bool -> Steps Id Bool) -> Array r ix Bool -> Id Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix Bool -> Steps Id Bool
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sand #-}
sany :: Stream r ix e => (e -> Bool) -> Array r ix e -> Bool
sany :: (e -> Bool) -> Array r ix e -> Bool
sany e -> Bool
f = Id Bool -> Bool
forall a. Id a -> a
S.unId (Id Bool -> Bool)
-> (Array r ix e -> Id Bool) -> Array r ix e -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id Bool -> Id Bool
forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.or (Steps Id Bool -> Id Bool)
-> (Array r ix e -> Steps Id Bool) -> Array r ix e -> Id Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Bool) -> Steps Id e -> Steps Id Bool
forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map e -> Bool
f (Steps Id e -> Steps Id Bool)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Steps Id Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sany #-}
sall :: Stream r ix e => (e -> Bool) -> Array r ix e -> Bool
sall :: (e -> Bool) -> Array r ix e -> Bool
sall e -> Bool
f = Id Bool -> Bool
forall a. Id a -> a
S.unId (Id Bool -> Bool)
-> (Array r ix e -> Id Bool) -> Array r ix e -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Steps Id Bool -> Id Bool
forall (m :: * -> *). Monad m => Steps m Bool -> m Bool
S.and (Steps Id Bool -> Id Bool)
-> (Array r ix e -> Steps Id Bool) -> Array r ix e -> Id Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Bool) -> Steps Id e -> Steps Id Bool
forall (m :: * -> *) e a.
Monad m =>
(e -> a) -> Steps m e -> Steps m a
S.map e -> Bool
f (Steps Id e -> Steps Id Bool)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Steps Id Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
toStream
{-# INLINE sall #-}
ssum :: (Num e, Stream r ix e) => Array r ix e -> e
ssum :: Array r ix e -> e
ssum = (e -> e -> e) -> e -> Array r ix e -> e
forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> a
sfoldl e -> e -> e
forall a. Num a => a -> a -> a
(+) e
0
{-# INLINE ssum #-}
sproduct :: (Num e, Stream r ix e) => Array r ix e -> e
sproduct :: Array r ix e -> e
sproduct = (e -> e -> e) -> e -> Array r ix e -> e
forall r ix e a.
Stream r ix e =>
(a -> e -> a) -> a -> Array r ix e -> a
sfoldl e -> e -> e
forall a. Num a => a -> a -> a
(*) e
1
{-# INLINE sproduct #-}
smaximum' :: (Ord e, Stream r ix e) => Array r ix e -> e
smaximum' :: Array r ix e -> e
smaximum' = (e -> e -> e) -> Array r ix e -> e
forall r ix e. Stream r ix e => (e -> e -> e) -> Array r ix e -> e
sfoldl1' e -> e -> e
forall a. Ord a => a -> a -> a
max
{-# INLINE smaximum' #-}
smaximumM :: (Ord e, Stream r ix e, MonadThrow m) => Array r ix e -> m e
smaximumM :: Array r ix e -> m e
smaximumM = (e -> e -> m e) -> Array r ix e -> m e
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 -> e -> m e
forall (f :: * -> *) a. Applicative f => a -> f a
pure (e -> e -> e
forall a. Ord a => a -> a -> a
max e
e e
acc))
{-# INLINE smaximumM #-}
sminimum' :: (Ord e, Stream r ix e) => Array r ix e -> e
sminimum' :: Array r ix e -> e
sminimum' = (e -> e -> e) -> Array r ix e -> e
forall r ix e. Stream r ix e => (e -> e -> e) -> Array r ix e -> e
sfoldl1' e -> e -> e
forall a. Ord a => a -> a -> a
min
{-# INLINE sminimum' #-}
sminimumM :: (Ord e, Stream r ix e, MonadThrow m) => Array r ix e -> m e
sminimumM :: Array r ix e -> m e
sminimumM = (e -> e -> m e) -> Array r ix e -> m e
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 -> e -> m e
forall (f :: * -> *) a. Applicative f => a -> f a
pure (e -> e -> e
forall a. Ord a => a -> a -> a
min e
e e
acc))
{-# INLINE sminimumM #-}
takeS :: Stream r ix e => Sz1 -> Array r ix e -> Array DS Ix1 e
takeS :: Sz1 -> Array r ix e -> Array DS Int e
takeS Sz1
n = Steps Id e -> Array DS Int e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Array DS Int e)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Array DS Int e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Steps Id e -> Steps Id e
forall (m :: * -> *) a. Monad m => Int -> Steps m a -> Steps m a
S.take (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) (Steps Id e -> Steps Id e)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Steps Id e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE takeS #-}
{-# DEPRECATED takeS "In favor of `stake`" #-}
dropS :: Stream r ix e => Sz1 -> Array r ix e -> Array DS Ix1 e
dropS :: Sz1 -> Array r ix e -> Array DS Int e
dropS Sz1
n = Steps Id e -> Array DS Int e
forall e. Steps Id e -> Array DS Int e
fromSteps (Steps Id e -> Array DS Int e)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Array DS Int e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Steps Id e -> Steps Id e
forall (m :: * -> *) a. Monad m => Int -> Steps m a -> Steps m a
S.drop (Sz1 -> Int
forall ix. Sz ix -> ix
unSz Sz1
n) (Steps Id e -> Steps Id e)
-> (Array r ix e -> Steps Id e) -> Array r ix e -> Steps Id e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream
{-# INLINE dropS #-}
{-# DEPRECATED dropS "In favor of `sdrop`" #-}
unfoldr :: (s -> Maybe (e, s)) -> s -> Vector DS e
unfoldr :: (s -> Maybe (e, s)) -> s -> Vector DS e
unfoldr = (s -> Maybe (e, s)) -> s -> Vector DS e
forall s e. (s -> Maybe (e, s)) -> s -> Vector DS e
sunfoldr
{-# INLINE unfoldr #-}
{-# DEPRECATED unfoldr "In favor of `sunfoldr`" #-}
unfoldrN :: Sz1 -> (s -> Maybe (e, s)) -> s -> Vector DS e
unfoldrN :: Sz1 -> (s -> Maybe (e, s)) -> s -> Vector DS e
unfoldrN = Sz1 -> (s -> Maybe (e, s)) -> s -> Vector DS e
forall s e. Sz1 -> (s -> Maybe (e, s)) -> s -> Vector DS e
unfoldrN
{-# INLINE unfoldrN #-}
{-# DEPRECATED unfoldrN "In favor of `sunfoldrN`" #-}
filterM :: (S.Stream r ix e, Applicative f) => (e -> f Bool) -> Array r ix e -> f (Vector DS e)
filterM :: (e -> f Bool) -> Array r ix e -> f (Vector DS e)
filterM e -> f Bool
f Array r ix e
arr = Steps Id e -> Vector DS e
forall e. Steps Id e -> Array DS Int e
DSArray (Steps Id e -> Vector DS e) -> f (Steps Id e) -> f (Vector DS e)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (e -> f Bool) -> Steps Id e -> f (Steps Id e)
forall (m :: * -> *) (f :: * -> *) e.
(Monad m, Applicative f) =>
(e -> f Bool) -> Steps Id e -> f (Steps m e)
S.filterA e -> f Bool
f (Array r ix e -> Steps Id e
forall r ix e. Stream r ix e => Array r ix e -> Steps Id e
S.toStream Array r ix e
arr)
{-# INLINE filterM #-}
{-# DEPRECATED filterM "In favor of `sfilterM`" #-}
filterS :: S.Stream r ix e => (e -> Bool) -> Array r ix e -> Array DS Ix1 e
filterS :: (e -> Bool) -> Array r ix e -> Array DS Int e
filterS = (e -> Bool) -> Array r ix e -> Array DS Int e
forall r ix e.
Stream r ix e =>
(e -> Bool) -> Array r ix e -> Vector DS e
sfilter
{-# INLINE filterS #-}
{-# DEPRECATED filterS "In favor of `sfilter`" #-}
mapMaybeS :: S.Stream r ix a => (a -> Maybe b) -> Array r ix a -> Vector DS b
mapMaybeS :: (a -> Maybe b) -> Array r ix a -> Vector DS b
mapMaybeS = (a -> Maybe b) -> Array r ix a -> Vector DS b
forall r ix a b.
Stream r ix a =>
(a -> Maybe b) -> Array r ix a -> Vector DS b
smapMaybe
{-# INLINE mapMaybeS #-}
{-# DEPRECATED mapMaybeS "In favor of `smapMaybe`" #-}
catMaybesS :: S.Stream r ix (Maybe a) => Array r ix (Maybe a) -> Vector DS a
catMaybesS :: Array r ix (Maybe a) -> Vector DS a
catMaybesS = Array r ix (Maybe a) -> Vector DS a
forall r ix a.
Stream r ix (Maybe a) =>
Array r ix (Maybe a) -> Vector DS a
scatMaybes
{-# INLINE catMaybesS #-}
{-# DEPRECATED catMaybesS "In favor of `scatMaybes`" #-}
mapMaybeM ::
(S.Stream r ix a, Applicative f) => (a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
mapMaybeM :: (a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
mapMaybeM = (a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
forall r ix a (f :: * -> *) b.
(Stream r ix a, Applicative f) =>
(a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
smapMaybeM
{-# INLINE mapMaybeM #-}
{-# DEPRECATED mapMaybeM "In favor of `smapMaybeM`" #-}
traverseS :: (S.Stream r ix a, Applicative f) => (a -> f b) -> Array r ix a -> f (Vector DS b)
traverseS :: (a -> f b) -> Array r ix a -> f (Vector DS b)
traverseS = (a -> f b) -> Array r ix a -> f (Vector DS b)
forall r ix a (f :: * -> *) b.
(Stream r ix a, Applicative f) =>
(a -> f b) -> Array r ix a -> f (Vector DS b)
straverse
{-# INLINE traverseS #-}
{-# DEPRECATED traverseS "In favor of `straverse`" #-}
imapMaybeS :: Source r ix a => (ix -> a -> Maybe b) -> Array r ix a -> Array DS Ix1 b
imapMaybeS :: (ix -> a -> Maybe b) -> Array r ix a -> Array DS Int b
imapMaybeS ix -> a -> Maybe b
f Array r ix a
arr =
((ix, a) -> Maybe b) -> Array D ix (ix, a) -> Array DS Int b
forall r ix a b.
Stream r ix a =>
(a -> Maybe b) -> Array r ix a -> Vector DS b
mapMaybeS ((ix -> a -> Maybe b) -> (ix, a) -> Maybe b
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> Maybe b
f) (Array D ix (ix, a) -> Array DS Int b)
-> Array D ix (ix, a) -> Array DS Int b
forall a b. (a -> b) -> a -> b
$ D -> Comp -> Sz ix -> (ix -> (ix, a)) -> Array D ix (ix, a)
forall r ix e.
Construct r ix e =>
r -> Comp -> Sz ix -> (ix -> e) -> Array r ix e
A.makeArrayR D
D (Array r ix a -> Comp
forall r ix e. Load r ix e => Array r ix e -> Comp
getComp Array r ix a
arr) (Array r ix a -> Sz ix
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Array r ix a
arr) ((ix -> (ix, a)) -> Array D ix (ix, a))
-> (ix -> (ix, a)) -> Array D ix (ix, a)
forall a b. (a -> b) -> a -> b
$ \ix
ix -> (ix
ix, Array r ix a -> ix -> a
forall r ix e. Source r ix e => Array r ix e -> ix -> e
unsafeIndex Array r ix a
arr ix
ix)
{-# INLINE imapMaybeS #-}
{-# DEPRECATED imapMaybeS "In favor of `simapMaybe`" #-}
imapMaybeM ::
(Source r ix a, Applicative f) => (ix -> a -> f (Maybe b)) -> Array r ix a -> f (Array DS Ix1 b)
imapMaybeM :: (ix -> a -> f (Maybe b)) -> Array r ix a -> f (Array DS Int b)
imapMaybeM ix -> a -> f (Maybe b)
f Array r ix a
arr =
((ix, a) -> f (Maybe b))
-> Array D ix (ix, a) -> f (Array DS Int b)
forall r ix a (f :: * -> *) b.
(Stream r ix a, Applicative f) =>
(a -> f (Maybe b)) -> Array r ix a -> f (Vector DS b)
mapMaybeM ((ix -> a -> f (Maybe b)) -> (ix, a) -> f (Maybe b)
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ix -> a -> f (Maybe b)
f) (Array D ix (ix, a) -> f (Array DS Int b))
-> Array D ix (ix, a) -> f (Array DS Int b)
forall a b. (a -> b) -> a -> b
$ D -> Comp -> Sz ix -> (ix -> (ix, a)) -> Array D ix (ix, a)
forall r ix e.
Construct r ix e =>
r -> Comp -> Sz ix -> (ix -> e) -> Array r ix e
A.makeArrayR D
D (Array r ix a -> Comp
forall r ix e. Load r ix e => Array r ix e -> Comp
getComp Array r ix a
arr) (Array r ix a -> Sz ix
forall r ix e. Load r ix e => Array r ix e -> Sz ix
size Array r ix a
arr) ((ix -> (ix, a)) -> Array D ix (ix, a))
-> (ix -> (ix, a)) -> Array D ix (ix, a)
forall a b. (a -> b) -> a -> b
$ \ix
ix -> (ix
ix, Array r ix a -> ix -> a
forall r ix e. Source r ix e => Array r ix e -> ix -> e
unsafeIndex Array r ix a
arr ix
ix)
{-# INLINE imapMaybeM #-}
{-# DEPRECATED imapMaybeM "In favor of `simapMaybeM`" #-}
ifilterS :: Source r ix a => (ix -> a -> Bool) -> Array r ix a -> Array DS Ix1 a
ifilterS :: (ix -> a -> Bool) -> Array r ix a -> Array DS Int a
ifilterS ix -> a -> Bool
f =
(ix -> a -> Maybe a) -> Array r ix a -> Array DS Int a
forall r ix a b.
Source r ix a =>
(ix -> a -> Maybe b) -> Array r ix a -> Array DS Int b
imapMaybeS ((ix -> a -> Maybe a) -> Array r ix a -> Array DS Int a)
-> (ix -> a -> Maybe a) -> Array r ix a -> Array DS Int a
forall a b. (a -> b) -> a -> b
$ \ix
ix a
e ->
if ix -> a -> Bool
f ix
ix a
e
then a -> Maybe a
forall a. a -> Maybe a
Just a
e
else Maybe a
forall a. Maybe a
Nothing
{-# INLINE ifilterS #-}
{-# DEPRECATED ifilterS "In favor of `sifilter`" #-}
ifilterM ::
(Source r ix a, Applicative f) => (ix -> a -> f Bool) -> Array r ix a -> f (Array DS Ix1 a)
ifilterM :: (ix -> a -> f Bool) -> Array r ix a -> f (Array DS Int a)
ifilterM ix -> a -> f Bool
f =
(ix -> a -> f (Maybe a)) -> Array r ix a -> f (Array DS Int a)
forall r ix a (f :: * -> *) b.
(Source r ix a, Applicative f) =>
(ix -> a -> f (Maybe b)) -> Array r ix a -> f (Array DS Int b)
imapMaybeM ((ix -> a -> f (Maybe a)) -> Array r ix a -> f (Array DS Int a))
-> (ix -> a -> f (Maybe a)) -> Array r ix a -> f (Array DS Int a)
forall a b. (a -> b) -> a -> b
$ \ix
ix a
e ->
(\Bool
p ->
if Bool
p
then a -> Maybe a
forall a. a -> Maybe a
Just a
e
else Maybe a
forall a. Maybe a
Nothing) (Bool -> Maybe a) -> f Bool -> f (Maybe a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
ix -> a -> f Bool
f ix
ix a
e
{-# INLINE ifilterM #-}
{-# DEPRECATED ifilterM "In favor of `sifilterM`" #-}