{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
module Data.Vector.SEXP
( Vector(..)
, Mutable.MVector(..)
, ElemRep
, VECTOR
, SVECTOR
, Data.Vector.SEXP.fromSEXP
, unsafeFromSEXP
, Data.Vector.SEXP.toSEXP
, unsafeToSEXP
, length
, null
, (!)
, (!?)
, head
, last
, unsafeIndex
, unsafeHead
, unsafeLast
, indexM
, headM
, lastM
, unsafeIndexM
, unsafeHeadM
, unsafeLastM
, slice
, init
, take
, drop
, tail
, splitAt
, unsafeTail
, unsafeSlice
, unsafeDrop
, unsafeTake
, unsafeInit
, empty
, singleton
, replicate
, generate
, iterateN
, replicateM
, generateM
, create
, unfoldr
, unfoldrN
, constructN
, constructrN
, enumFromN
, enumFromStepN
, enumFromTo
, enumFromThenTo
, cons
, snoc
, (++)
, concat
, force
, (//)
, unsafeUpd
, accum
, unsafeAccum
, reverse
, map
, imap
, concatMap
, mapM
, mapM_
, forM
, forM_
, zipWith
, zipWith3
, zipWith4
, zipWith5
, zipWith6
, izipWith
, izipWith3
, izipWith4
, izipWith5
, izipWith6
, zipWithM
, zipWithM_
, filter
, ifilter
, filterM
, takeWhile
, dropWhile
, partition
, unstablePartition
, span
, break
, elem
, notElem
, find
, findIndex
, elemIndex
, foldl
, foldl1
, foldl'
, foldl1'
, foldr
, foldr1
, foldr'
, foldr1'
, ifoldl
, ifoldl'
, ifoldr
, ifoldr'
, all
, any
, sum
, product
, maximum
, maximumBy
, minimum
, minimumBy
, minIndex
, minIndexBy
, maxIndex
, maxIndexBy
, foldM
, foldM'
, fold1M
, fold1M'
, foldM_
, foldM'_
, fold1M_
, fold1M'_
, prescanl
, prescanl'
, postscanl
, postscanl'
, scanl
, scanl'
, scanl1
, scanl1'
, prescanr
, prescanr'
, postscanr
, postscanr'
, scanr
, scanr'
, scanr1
, scanr1'
, toList
, fromList
, fromListN
, freeze
, thaw
, copy
, unsafeFreeze
, unsafeThaw
, unsafeCopy
, toString
, toByteString
, unsafeWithByteString
) where
import Control.Exception (evaluate)
import Control.Monad.R.Class
import Control.Monad.R.Internal
import Control.Memory.Region
import Data.Vector.SEXP.Base
import Data.Vector.SEXP.Mutable (MVector)
import qualified Data.Vector.SEXP.Mutable as Mutable
import qualified Data.Vector.SEXP.Mutable.Internal as Mutable
import Foreign.R ( SEXP(..) )
import qualified Foreign.R as R
import Foreign.R.Type ( SEXPTYPE(Char) )
import Control.Monad.ST (ST, runST)
import Data.Int
import Data.Proxy (Proxy(..))
import Data.Reflection (Reifies(..), reify)
import qualified Data.Vector.Generic as G
import Data.Vector.Generic.New (run)
import Data.ByteString ( ByteString )
import qualified Data.ByteString as B
import qualified Data.ByteString.Unsafe as B
import Control.Applicative hiding (empty)
import Control.Exception (mask_)
#if MIN_VERSION_vector(0,11,0)
import qualified Data.Vector.Fusion.Bundle.Monadic as Bundle
import Data.Vector.Fusion.Bundle.Monadic (sSize, sElems)
import Data.Vector.Fusion.Bundle.Size (Size(Unknown), smaller)
import Data.Vector.Fusion.Bundle (lift)
import qualified Data.Vector.Fusion.Stream.Monadic as Stream
import qualified Data.List as List
#else
import qualified Data.Vector.Fusion.Stream as Stream
import qualified Data.Vector.Fusion.Stream.Monadic as MStream
#endif
import Control.Monad.Primitive ( PrimMonad, unsafeInlineIO, unsafePrimToPrim )
import qualified Control.DeepSeq as DeepSeq
import Data.Word ( Word8 )
import Foreign ( Storable, Ptr, castPtr, peekElemOff )
import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)
import Foreign.Marshal.Array ( copyArray )
import qualified GHC.Foreign as GHC
import qualified GHC.ForeignPtr as GHC
import GHC.IO.Encoding.UTF8
#if __GLASGOW_HASKELL__ >= 708
import qualified GHC.Exts as Exts
#endif
import System.IO.Unsafe
import Prelude
( Eq(..)
, Enum
, Monad(..)
, Num(..)
, Ord(..)
, Show(..)
, Bool
, IO
, Maybe
, Ordering
, String
, (.)
, ($)
, fromIntegral
, seq
, uncurry
)
import qualified Prelude
newtype ForeignSEXP (ty::SEXPTYPE) = ForeignSEXP (ForeignPtr ())
foreignSEXP :: PrimMonad m => SEXP s ty -> m (ForeignSEXP ty)
foreignSEXP :: SEXP s ty -> m (ForeignSEXP ty)
foreignSEXP sx :: SEXP s ty
sx@(SEXP ptr :: Ptr (HExp s ty)
ptr) =
IO (ForeignSEXP ty) -> m (ForeignSEXP ty)
forall (m1 :: * -> *) (m2 :: * -> *) a.
(PrimBase m1, PrimMonad m2) =>
m1 a -> m2 a
unsafePrimToPrim (IO (ForeignSEXP ty) -> m (ForeignSEXP ty))
-> IO (ForeignSEXP ty) -> m (ForeignSEXP ty)
forall a b. (a -> b) -> a -> b
$ IO (ForeignSEXP ty) -> IO (ForeignSEXP ty)
forall a. IO a -> IO a
mask_ (IO (ForeignSEXP ty) -> IO (ForeignSEXP ty))
-> IO (ForeignSEXP ty) -> IO (ForeignSEXP ty)
forall a b. (a -> b) -> a -> b
$ do
SEXP s ty -> IO ()
forall s (a :: SEXPTYPE). SEXP s a -> IO ()
R.preserveObject SEXP s ty
sx
ForeignPtr () -> ForeignSEXP ty
forall (ty :: SEXPTYPE). ForeignPtr () -> ForeignSEXP ty
ForeignSEXP (ForeignPtr () -> ForeignSEXP ty)
-> IO (ForeignPtr ()) -> IO (ForeignSEXP ty)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr () -> IO () -> IO (ForeignPtr ())
forall a. Ptr a -> IO () -> IO (ForeignPtr a)
GHC.newConcForeignPtr (Ptr (HExp s ty) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr Ptr (HExp s ty)
ptr) (SEXP s ty -> IO ()
forall s (a :: SEXPTYPE). SEXP s a -> IO ()
R.releaseObject SEXP s ty
sx)
withForeignSEXP
:: ForeignSEXP ty
-> (SEXP V ty -> IO r)
-> IO r
withForeignSEXP :: ForeignSEXP ty -> (SEXP V ty -> IO r) -> IO r
withForeignSEXP (ForeignSEXP fptr :: ForeignPtr ()
fptr) f :: SEXP V ty -> IO r
f =
ForeignPtr () -> (Ptr () -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fptr ((Ptr () -> IO r) -> IO r) -> (Ptr () -> IO r) -> IO r
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr ()
ptr -> SEXP V ty -> IO r
f (Ptr (HExp V ty) -> SEXP V ty
forall s (a :: SEXPTYPE). Ptr (HExp s a) -> SEXP s a
SEXP (Ptr () -> Ptr (HExp V ty)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
ptr))
data Vector (ty :: SEXPTYPE) a = Vector
{ Vector ty a -> ForeignSEXP ty
vectorBase :: {-# UNPACK #-} !(ForeignSEXP ty)
, Vector ty a -> Int32
vectorOffset :: {-# UNPACK #-} !Int32
, Vector ty a -> Int32
vectorLength :: {-# UNPACK #-} !Int32
}
instance (Eq a, SVECTOR ty a) => Eq (Vector ty a) where
a :: Vector ty a
a == :: Vector ty a -> Vector ty a -> Bool
== b :: Vector ty a
b = Vector ty a -> [a]
forall (ty :: SEXPTYPE) a. SVECTOR ty a => Vector ty a -> [a]
toList Vector ty a
a [a] -> [a] -> Bool
forall a. Eq a => a -> a -> Bool
== Vector ty a -> [a]
forall (ty :: SEXPTYPE) a. SVECTOR ty a => Vector ty a -> [a]
toList Vector ty a
b
instance (Show a, SVECTOR ty a) => Show (Vector ty a) where
show :: Vector ty a -> String
show v :: Vector ty a
v = "fromList " String -> ShowS
forall a. [a] -> [a] -> [a]
Prelude.++ [a] -> ShowS
forall a. Show a => [a] -> ShowS
showList (Vector ty a -> [a]
forall (ty :: SEXPTYPE) a. SVECTOR ty a => Vector ty a -> [a]
toList Vector ty a
v) ""
newtype W t ty a = W { W t ty a -> Vector ty a
unW :: Vector ty a }
withW :: proxy t -> Vector ty a -> W t ty a
withW :: proxy t -> Vector ty a -> W t ty a
withW _ v :: Vector ty a
v = Vector ty a -> W t ty a
forall t (ty :: SEXPTYPE) a. Vector ty a -> W t ty a
W Vector ty a
v
proxyFW :: (W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW :: (W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW f :: W t ty a -> r
f v :: Vector ty a
v p :: p t
p = W t ty a -> r
f (p t -> Vector ty a -> W t ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW p t
p Vector ty a
v)
proxyFW2 :: (W t tya a -> W t tyb b -> r) -> Vector tya a -> Vector tyb b -> p t -> r
proxyFW2 :: (W t tya a -> W t tyb b -> r)
-> Vector tya a -> Vector tyb b -> p t -> r
proxyFW2 f :: W t tya a -> W t tyb b -> r
f v1 :: Vector tya a
v1 v2 :: Vector tyb b
v2 p :: p t
p = W t tya a -> W t tyb b -> r
f (p t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW p t
p Vector tya a
v1) (p t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW p t
p Vector tyb b
v2)
proxyW :: W t ty a -> p t -> Vector ty a
proxyW :: W t ty a -> p t -> Vector ty a
proxyW v :: W t ty a
v _ = W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
v
type instance G.Mutable (W t ty) = Mutable.W t ty
instance (Reifies t (AcquireIO s), SVECTOR ty a) => G.Vector (W t ty) a where
{-# INLINE basicUnsafeFreeze #-}
basicUnsafeFreeze :: Mutable (W t ty) (PrimState m) a -> m (W t ty a)
basicUnsafeFreeze (Mutable (W t ty) (PrimState m) a -> MVector (PrimState m) ty a
forall t (ty :: SEXPTYPE) s a. W t ty s a -> MVector s ty a
Mutable.unW -> Mutable.MVector sx :: SEXP (PrimState m) ty
sx off :: Int32
off len :: Int32
len) = do
ForeignSEXP ty
fp <- SEXP (PrimState m) ty -> m (ForeignSEXP ty)
forall (m :: * -> *) s (ty :: SEXPTYPE).
PrimMonad m =>
SEXP s ty -> m (ForeignSEXP ty)
foreignSEXP SEXP (PrimState m) ty
sx
W t ty a -> m (W t ty a)
forall (m :: * -> *) a. Monad m => a -> m a
return (W t ty a -> m (W t ty a)) -> W t ty a -> m (W t ty a)
forall a b. (a -> b) -> a -> b
$ Vector ty a -> W t ty a
forall t (ty :: SEXPTYPE) a. Vector ty a -> W t ty a
W (Vector ty a -> W t ty a) -> Vector ty a -> W t ty a
forall a b. (a -> b) -> a -> b
$ ForeignSEXP ty -> Int32 -> Int32 -> Vector ty a
forall (ty :: SEXPTYPE) a.
ForeignSEXP ty -> Int32 -> Int32 -> Vector ty a
Vector ForeignSEXP ty
fp Int32
off Int32
len
{-# INLINE basicUnsafeThaw #-}
basicUnsafeThaw :: W t ty a -> m (Mutable (W t ty) (PrimState m) a)
basicUnsafeThaw (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW -> Vector fp :: ForeignSEXP ty
fp off :: Int32
off len :: Int32
len) = IO (W t ty (PrimState m) a) -> m (Mutable (W t ty) (PrimState m) a)
forall (m1 :: * -> *) (m2 :: * -> *) a.
(PrimBase m1, PrimMonad m2) =>
m1 a -> m2 a
unsafePrimToPrim (IO (W t ty (PrimState m) a)
-> m (Mutable (W t ty) (PrimState m) a))
-> IO (W t ty (PrimState m) a)
-> m (Mutable (W t ty) (PrimState m) a)
forall a b. (a -> b) -> a -> b
$
ForeignSEXP ty
-> (SEXP V ty -> IO (W t ty (PrimState m) a))
-> IO (W t ty (PrimState m) a)
forall (ty :: SEXPTYPE) r.
ForeignSEXP ty -> (SEXP V ty -> IO r) -> IO r
withForeignSEXP ForeignSEXP ty
fp ((SEXP V ty -> IO (W t ty (PrimState m) a))
-> IO (W t ty (PrimState m) a))
-> (SEXP V ty -> IO (W t ty (PrimState m) a))
-> IO (W t ty (PrimState m) a)
forall a b. (a -> b) -> a -> b
$ \ptr :: SEXP V ty
ptr -> do
SEXP s ty
sx' <- SEXP V ty -> IO (SEXP s ty)
forall (ty :: SEXPTYPE). SEXP V ty -> IO (SEXP s ty)
acquireIO (SEXP V ty -> SEXP V ty
forall t s (a :: SEXPTYPE). (t <= s) => SEXP s a -> SEXP t a
R.release SEXP V ty
ptr)
W t ty (PrimState m) a -> IO (W t ty (PrimState m) a)
forall (m :: * -> *) a. Monad m => a -> m a
return (W t ty (PrimState m) a -> IO (W t ty (PrimState m) a))
-> W t ty (PrimState m) a -> IO (W t ty (PrimState m) a)
forall a b. (a -> b) -> a -> b
$ Proxy t -> MVector (PrimState m) ty a -> W t ty (PrimState m) a
forall (proxy :: * -> *) t s (ty :: SEXPTYPE) a.
proxy t -> MVector s ty a -> W t ty s a
Mutable.withW Proxy t
p (MVector (PrimState m) ty a -> W t ty (PrimState m) a)
-> MVector (PrimState m) ty a -> W t ty (PrimState m) a
forall a b. (a -> b) -> a -> b
$ SEXP (PrimState m) ty
-> Int32 -> Int32 -> MVector (PrimState m) ty a
forall s (ty :: SEXPTYPE) a.
SEXP s ty -> Int32 -> Int32 -> MVector s ty a
Mutable.MVector (SEXP s ty -> SEXP (PrimState m) ty
forall s (a :: SEXPTYPE) r. SEXP s a -> SEXP r a
R.unsafeRelease SEXP s ty
sx') Int32
off Int32
len
where
AcquireIO acquireIO :: forall (ty :: SEXPTYPE). SEXP V ty -> IO (SEXP s ty)
acquireIO = Proxy t -> AcquireIO s
forall k (s :: k) a (proxy :: k -> *). Reifies s a => proxy s -> a
reflect (Proxy t
forall k (t :: k). Proxy t
Proxy :: Proxy t)
p :: Proxy t
p = Proxy t
forall k (t :: k). Proxy t
Proxy :: Proxy t
basicLength :: W t ty a -> Int
basicLength (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW -> Vector _ _ len :: Int32
len) = Int32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
len
{-# INLINE basicUnsafeSlice #-}
basicUnsafeSlice :: Int -> Int -> W t ty a -> W t ty a
basicUnsafeSlice (Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral ->Int32
i)
(Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral ->Int32
n) (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW -> Vector fp :: ForeignSEXP ty
fp off :: Int32
off _len :: Int32
_len) = Vector ty a -> W t ty a
forall t (ty :: SEXPTYPE) a. Vector ty a -> W t ty a
W (Vector ty a -> W t ty a) -> Vector ty a -> W t ty a
forall a b. (a -> b) -> a -> b
$ ForeignSEXP ty -> Int32 -> Int32 -> Vector ty a
forall (ty :: SEXPTYPE) a.
ForeignSEXP ty -> Int32 -> Int32 -> Vector ty a
Vector ForeignSEXP ty
fp (Int32
off Int32 -> Int32 -> Int32
forall a. Num a => a -> a -> a
+ Int32
i) Int32
n
{-# INLINE basicUnsafeIndexM #-}
basicUnsafeIndexM :: W t ty a -> Int -> m a
basicUnsafeIndexM v :: W t ty a
v i :: Int
i = a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (a -> m a) -> (IO a -> a) -> IO a -> m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO a -> a
forall a. IO a -> a
unsafeInlineIO (IO a -> m a) -> IO a -> m a
forall a b. (a -> b) -> a -> b
$ Ptr a -> Int -> IO a
forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff (Vector ty a -> Ptr a
forall a (ty :: SEXPTYPE). Storable a => Vector ty a -> Ptr a
unsafeToPtr (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
v)) Int
i
{-# INLINE basicUnsafeCopy #-}
basicUnsafeCopy :: Mutable (W t ty) (PrimState m) a -> W t ty a -> m ()
basicUnsafeCopy mv :: Mutable (W t ty) (PrimState m) a
mv v :: W t ty a
v =
IO () -> m ()
forall (m1 :: * -> *) (m2 :: * -> *) a.
(PrimBase m1, PrimMonad m2) =>
m1 a -> m2 a
unsafePrimToPrim (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$
Ptr a -> Ptr a -> Int -> IO ()
forall a. Storable a => Ptr a -> Ptr a -> Int -> IO ()
copyArray (MVector (PrimState m) ty a -> Ptr a
forall a s (ty :: SEXPTYPE). Storable a => MVector s ty a -> Ptr a
Mutable.unsafeToPtr (W t ty (PrimState m) a -> MVector (PrimState m) ty a
forall t (ty :: SEXPTYPE) s a. W t ty s a -> MVector s ty a
Mutable.unW Mutable (W t ty) (PrimState m) a
W t ty (PrimState m) a
mv))
(Vector ty a -> Ptr a
forall a (ty :: SEXPTYPE). Storable a => Vector ty a -> Ptr a
unsafeToPtr (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
v))
(W t ty a -> Int
forall (v :: * -> *) a. Vector v a => v a -> Int
G.basicLength W t ty a
v)
{-# INLINE elemseq #-}
elemseq :: W t ty a -> a -> b -> b
elemseq _ = a -> b -> b
forall a b. a -> b -> b
seq
#if __GLASGOW_HASKELL__ >= 708
instance SVECTOR ty a => Exts.IsList (Vector ty a) where
type Item (Vector ty a) = a
fromList :: [Item (Vector ty a)] -> Vector ty a
fromList = [Item (Vector ty a)] -> Vector ty a
forall (ty :: SEXPTYPE) a. SVECTOR ty a => [a] -> Vector ty a
fromList
fromListN :: Int -> [Item (Vector ty a)] -> Vector ty a
fromListN = Int -> [Item (Vector ty a)] -> Vector ty a
forall (ty :: SEXPTYPE) a.
SVECTOR ty a =>
Int -> [a] -> Vector ty a
fromListN
toList :: Vector ty a -> [Item (Vector ty a)]
toList = Vector ty a -> [Item (Vector ty a)]
forall (ty :: SEXPTYPE) a. SVECTOR ty a => Vector ty a -> [a]
toList
#endif
unsafeToPtr :: Storable a => Vector ty a -> Ptr a
{-# INLINE unsafeToPtr #-}
unsafeToPtr :: Vector ty a -> Ptr a
unsafeToPtr (Vector fp :: ForeignSEXP ty
fp off :: Int32
off len :: Int32
len) = IO (Ptr a) -> Ptr a
forall a. IO a -> a
unsafeInlineIO (IO (Ptr a) -> Ptr a) -> IO (Ptr a) -> Ptr a
forall a b. (a -> b) -> a -> b
$ ForeignSEXP ty -> (SEXP V ty -> IO (Ptr a)) -> IO (Ptr a)
forall (ty :: SEXPTYPE) r.
ForeignSEXP ty -> (SEXP V ty -> IO r) -> IO r
withForeignSEXP ForeignSEXP ty
fp ((SEXP V ty -> IO (Ptr a)) -> IO (Ptr a))
-> (SEXP V ty -> IO (Ptr a)) -> IO (Ptr a)
forall a b. (a -> b) -> a -> b
$ \sx :: SEXP V ty
sx ->
Ptr a -> IO (Ptr a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr a -> IO (Ptr a)) -> Ptr a -> IO (Ptr a)
forall a b. (a -> b) -> a -> b
$ MVector V ty a -> Ptr a
forall a s (ty :: SEXPTYPE). Storable a => MVector s ty a -> Ptr a
Mutable.unsafeToPtr (MVector V ty a -> Ptr a) -> MVector V ty a -> Ptr a
forall a b. (a -> b) -> a -> b
$ SEXP V ty -> Int32 -> Int32 -> MVector V ty a
forall s (ty :: SEXPTYPE) a.
SEXP s ty -> Int32 -> Int32 -> MVector s ty a
Mutable.MVector SEXP V ty
sx Int32
off Int32
len
fromSEXP :: (SVECTOR ty a) => SEXP s ty -> Vector ty a
fromSEXP :: SEXP s ty -> Vector ty a
fromSEXP s :: SEXP s ty
s = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> (forall s. ST s (Vector ty a)) -> Vector ty a
forall a. (forall s. ST s a) -> a
runST ((forall s. ST s (Vector ty a)) -> Vector ty a)
-> (forall s. ST s (Vector ty a)) -> Vector ty a
forall a b. (a -> b) -> a -> b
$ do
W t ty s a
w <- New (W t ty) a -> ST s (Mutable (W t ty) s a)
forall (v :: * -> *) a s. New v a -> ST s (Mutable v s a)
run ((W t ty a -> New (W t ty) a)
-> Vector ty a -> Proxy t -> New (W t ty) a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> New (W t ty) a
forall (v :: * -> *) a. Vector v a => v a -> New v a
G.clone (SEXP s ty -> Vector ty a
forall (ty :: SEXPTYPE) a s.
SVECTOR ty a =>
SEXP s ty -> Vector ty a
unsafeFromSEXP SEXP s ty
s) Proxy t
p)
W t ty a
v <- Mutable (W t ty) (PrimState (ST s)) a -> ST s (W t ty a)
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
Mutable v (PrimState m) a -> m (v a)
G.unsafeFreeze Mutable (W t ty) (PrimState (ST s)) a
W t ty s a
w
Vector ty a -> ST s (Vector ty a)
forall (m :: * -> *) a. Monad m => a -> m a
return (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
v)
unsafeFromSEXP :: SVECTOR ty a
=> SEXP s ty
-> Vector ty a
unsafeFromSEXP :: SEXP s ty -> Vector ty a
unsafeFromSEXP s :: SEXP s ty
s = IO (Vector ty a) -> Vector ty a
forall a. IO a -> a
unsafeInlineIO (IO (Vector ty a) -> Vector ty a)
-> IO (Vector ty a) -> Vector ty a
forall a b. (a -> b) -> a -> b
$ do
ForeignSEXP ty
sxp <- SEXP s ty -> IO (ForeignSEXP ty)
forall (m :: * -> *) s (ty :: SEXPTYPE).
PrimMonad m =>
SEXP s ty -> m (ForeignSEXP ty)
foreignSEXP SEXP s ty
s
Int
l <- SEXP s ty -> IO Int
forall (a :: SEXPTYPE) s. IsVector a => SEXP s a -> IO Int
R.length SEXP s ty
s
Vector ty a -> IO (Vector ty a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Vector ty a -> IO (Vector ty a))
-> Vector ty a -> IO (Vector ty a)
forall a b. (a -> b) -> a -> b
$ ForeignSEXP ty -> Int32 -> Int32 -> Vector ty a
forall (ty :: SEXPTYPE) a.
ForeignSEXP ty -> Int32 -> Int32 -> Vector ty a
Vector ForeignSEXP ty
sxp 0 (Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
l)
toSEXP :: SVECTOR ty a => Vector ty a -> SEXP s ty
toSEXP :: Vector ty a -> SEXP s ty
toSEXP s :: Vector ty a
s = (forall t. Reifies t (AcquireIO Any) => Proxy t -> SEXP s ty)
-> SEXP s ty
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> SEXP s ty)
-> SEXP s ty)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> SEXP s ty)
-> SEXP s ty
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> (forall s. ST s (SEXP s ty)) -> SEXP s ty
forall a. (forall s. ST s a) -> a
runST ((forall s. ST s (SEXP s ty)) -> SEXP s ty)
-> (forall s. ST s (SEXP s ty)) -> SEXP s ty
forall a b. (a -> b) -> a -> b
$ do
W t ty s a
w <- New (W t ty) a -> ST s (Mutable (W t ty) s a)
forall (v :: * -> *) a s. New v a -> ST s (Mutable v s a)
run ((W t ty a -> New (W t ty) a)
-> Vector ty a -> Proxy t -> New (W t ty) a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> New (W t ty) a
forall (v :: * -> *) a. Vector v a => v a -> New v a
G.clone Vector ty a
s Proxy t
p)
W t ty a
v <- Mutable (W t ty) (PrimState (ST s)) a -> ST s (W t ty a)
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
Mutable v (PrimState m) a -> m (v a)
G.unsafeFreeze Mutable (W t ty) (PrimState (ST s)) a
W t ty s a
w
SEXP s ty -> ST s (SEXP s ty)
forall (m :: * -> *) a. Monad m => a -> m a
return (Vector ty a -> SEXP s ty
forall (ty :: SEXPTYPE) a s.
SVECTOR ty a =>
Vector ty a -> SEXP s ty
unsafeToSEXP (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
v))
unsafeToSEXP :: SVECTOR ty a => Vector ty a -> SEXP s ty
unsafeToSEXP :: Vector ty a -> SEXP s ty
unsafeToSEXP (Vector (ForeignSEXP fsx :: ForeignPtr ()
fsx) _ _) = IO (SEXP s ty) -> SEXP s ty
forall a. IO a -> a
unsafePerformIO (IO (SEXP s ty) -> SEXP s ty) -> IO (SEXP s ty) -> SEXP s ty
forall a b. (a -> b) -> a -> b
$
ForeignPtr () -> (Ptr () -> IO (SEXP s ty)) -> IO (SEXP s ty)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ()
fsx ((Ptr () -> IO (SEXP s ty)) -> IO (SEXP s ty))
-> (Ptr () -> IO (SEXP s ty)) -> IO (SEXP s ty)
forall a b. (a -> b) -> a -> b
$ SEXP s ty -> IO (SEXP s ty)
forall (m :: * -> *) a. Monad m => a -> m a
return (SEXP s ty -> IO (SEXP s ty))
-> (Ptr () -> SEXP s ty) -> Ptr () -> IO (SEXP s ty)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SEXP0 -> SEXP s ty
forall s (a :: SEXPTYPE). SEXP0 -> SEXP s a
R.sexp (SEXP0 -> SEXP s ty) -> (Ptr () -> SEXP0) -> Ptr () -> SEXP s ty
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr () -> SEXP0
forall a b. Ptr a -> Ptr b
castPtr
toString :: Vector 'Char Word8 -> String
toString :: Vector 'Char Word8 -> String
toString v :: Vector 'Char Word8
v = IO String -> String
forall a. IO a -> a
unsafeInlineIO (IO String -> String) -> IO String -> String
forall a b. (a -> b) -> a -> b
$
TextEncoding -> CStringLen -> IO String
GHC.peekCStringLen TextEncoding
utf8 ( Ptr Word8 -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr (Ptr Word8 -> Ptr CChar) -> Ptr Word8 -> Ptr CChar
forall a b. (a -> b) -> a -> b
$ Vector 'Char Word8 -> Ptr Word8
forall a (ty :: SEXPTYPE). Storable a => Vector ty a -> Ptr a
unsafeToPtr Vector 'Char Word8
v
, Int32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int32 -> Int) -> Int32 -> Int
forall a b. (a -> b) -> a -> b
$ Vector 'Char Word8 -> Int32
forall (ty :: SEXPTYPE) a. Vector ty a -> Int32
vectorLength Vector 'Char Word8
v)
toByteString :: Vector 'Char Word8 -> ByteString
toByteString :: Vector 'Char Word8 -> ByteString
toByteString v :: Vector 'Char Word8
v = IO ByteString -> ByteString
forall a. IO a -> a
unsafeInlineIO (IO ByteString -> ByteString) -> IO ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
CStringLen -> IO ByteString
B.packCStringLen ( Ptr Word8 -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr (Ptr Word8 -> Ptr CChar) -> Ptr Word8 -> Ptr CChar
forall a b. (a -> b) -> a -> b
$ Vector 'Char Word8 -> Ptr Word8
forall a (ty :: SEXPTYPE). Storable a => Vector ty a -> Ptr a
unsafeToPtr Vector 'Char Word8
v
, Int32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int32 -> Int) -> Int32 -> Int
forall a b. (a -> b) -> a -> b
$ Vector 'Char Word8 -> Int32
forall (ty :: SEXPTYPE) a. Vector ty a -> Int32
vectorLength Vector 'Char Word8
v)
unsafeWithByteString :: DeepSeq.NFData a => Vector 'Char Word8 -> (ByteString -> IO a) -> a
unsafeWithByteString :: Vector 'Char Word8 -> (ByteString -> IO a) -> a
unsafeWithByteString v :: Vector 'Char Word8
v f :: ByteString -> IO a
f = IO a -> a
forall a. IO a -> a
unsafeInlineIO (IO a -> a) -> IO a -> a
forall a b. (a -> b) -> a -> b
$ do
ByteString
x <- CStringLen -> IO ByteString
B.unsafePackCStringLen (Ptr Word8 -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr (Ptr Word8 -> Ptr CChar) -> Ptr Word8 -> Ptr CChar
forall a b. (a -> b) -> a -> b
$ Vector 'Char Word8 -> Ptr Word8
forall a (ty :: SEXPTYPE). Storable a => Vector ty a -> Ptr a
unsafeToPtr Vector 'Char Word8
v
,Int32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int32 -> Int) -> Int32 -> Int
forall a b. (a -> b) -> a -> b
$ Vector 'Char Word8 -> Int32
forall (ty :: SEXPTYPE) a. Vector ty a -> Int32
vectorLength Vector 'Char Word8
v)
a
w <- a -> a
forall a. NFData a => a -> a
DeepSeq.force (a -> a) -> IO a -> IO a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ByteString -> IO a
f ByteString
x
a -> IO a
forall a. a -> IO a
evaluate a
w
length :: SVECTOR ty a => Vector ty a -> Int
{-# INLINE length #-}
length :: Vector ty a -> Int
length v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Int) -> Vector ty a -> Proxy t -> Int
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> Int
forall (v :: * -> *) a. Vector v a => v a -> Int
G.length Vector ty a
v
null :: SVECTOR ty a => Vector ty a -> Bool
{-# INLINE null #-}
null :: Vector ty a -> Bool
null v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Bool) -> Vector ty a -> Proxy t -> Bool
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> Bool
forall (v :: * -> *) a. Vector v a => v a -> Bool
G.null Vector ty a
v
(!) :: SVECTOR ty a => Vector ty a -> Int -> a
{-# INLINE (!) #-}
(!) v :: Vector ty a
v i :: Int
i = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> Int -> a
forall (v :: * -> *) a. Vector v a => v a -> Int -> a
G.! Int
i) Vector ty a
v
(!?) :: SVECTOR ty a => Vector ty a -> Int -> Maybe a
{-# INLINE (!?) #-}
!? :: Vector ty a -> Int -> Maybe a
(!?) v :: Vector ty a
v i :: Int
i = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe a)
-> Maybe a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe a)
-> Maybe a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe a)
-> Maybe a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Maybe a) -> Vector ty a -> Proxy t -> Maybe a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> Int -> Maybe a
forall (v :: * -> *) a. Vector v a => v a -> Int -> Maybe a
G.!? Int
i) Vector ty a
v
head :: SVECTOR ty a => Vector ty a -> a
{-# INLINE head #-}
head :: Vector ty a -> a
head v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. Vector v a => v a -> a
G.head Vector ty a
v
last :: SVECTOR ty a => Vector ty a -> a
{-# INLINE last #-}
last :: Vector ty a -> a
last v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. Vector v a => v a -> a
G.last Vector ty a
v
unsafeIndex :: SVECTOR ty a => Vector ty a -> Int -> a
{-# INLINE unsafeIndex #-}
unsafeIndex :: Vector ty a -> Int -> a
unsafeIndex v :: Vector ty a
v i :: Int
i = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> Int -> a
forall (v :: * -> *) a. Vector v a => v a -> Int -> a
`G.unsafeIndex` Int
i) Vector ty a
v
unsafeHead :: SVECTOR ty a => Vector ty a -> a
{-# INLINE unsafeHead #-}
unsafeHead :: Vector ty a -> a
unsafeHead v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. Vector v a => v a -> a
G.unsafeHead Vector ty a
v
unsafeLast :: SVECTOR ty a => Vector ty a -> a
{-# INLINE unsafeLast #-}
unsafeLast :: Vector ty a -> a
unsafeLast v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. Vector v a => v a -> a
G.unsafeLast Vector ty a
v
indexM :: (SVECTOR ty a, Monad m) => Vector ty a -> Int -> m a
{-# INLINE indexM #-}
indexM :: Vector ty a -> Int -> m a
indexM v :: Vector ty a
v i :: Int
i = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m a) -> Vector ty a -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> Int -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> Int -> m a
`G.indexM` Int
i) Vector ty a
v
headM :: (SVECTOR ty a, Monad m) => Vector ty a -> m a
{-# INLINE headM #-}
headM :: Vector ty a -> m a
headM v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m a) -> Vector ty a -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> m a
G.headM Vector ty a
v
lastM :: (SVECTOR ty a, Monad m) => Vector ty a -> m a
{-# INLINE lastM #-}
lastM :: Vector ty a -> m a
lastM v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m a) -> Vector ty a -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> m a
G.lastM Vector ty a
v
unsafeIndexM :: (SVECTOR ty a, Monad m) => Vector ty a -> Int -> m a
{-# INLINE unsafeIndexM #-}
unsafeIndexM :: Vector ty a -> Int -> m a
unsafeIndexM v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int -> m a)
-> Int -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Int -> m a)
-> Int -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int -> m a)
-> Int
-> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Int -> m a) -> Vector ty a -> Proxy t -> Int -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> Int -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> Int -> m a
G.unsafeIndexM Vector ty a
v
unsafeHeadM :: (SVECTOR ty a, Monad m) => Vector ty a -> m a
{-# INLINE unsafeHeadM #-}
unsafeHeadM :: Vector ty a -> m a
unsafeHeadM v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m a) -> Vector ty a -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> m a
G.unsafeHeadM Vector ty a
v
unsafeLastM :: (SVECTOR ty a, Monad m) => Vector ty a -> m a
{-# INLINE unsafeLastM #-}
unsafeLastM :: Vector ty a -> m a
unsafeLastM v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m a) -> Vector ty a -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> m a
G.unsafeLastM Vector ty a
v
slice :: SVECTOR ty a
=> Int
-> Int
-> Vector ty a
-> Vector ty a
{-# INLINE slice #-}
slice :: Int -> Int -> Vector ty a -> Vector ty a
slice i :: Int
i n :: Int
n v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (Int -> Int -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> Int -> v a -> v a
G.slice Int
i Int
n) Vector ty a
v
init :: SVECTOR ty a => Vector ty a -> Vector ty a
{-# INLINE init #-}
init :: Vector ty a -> Vector ty a
init v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> v a
G.init Vector ty a
v
tail :: SVECTOR ty a => Vector ty a -> Vector ty a
{-# INLINE tail #-}
tail :: Vector ty a -> Vector ty a
tail v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> v a
G.tail Vector ty a
v
take :: SVECTOR ty a => Int -> Vector ty a -> Vector ty a
{-# INLINE take #-}
take :: Int -> Vector ty a -> Vector ty a
take i :: Int
i v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (Int -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> v a -> v a
G.take Int
i) Vector ty a
v
drop :: SVECTOR ty a => Int -> Vector ty a -> Vector ty a
{-# INLINE drop #-}
drop :: Int -> Vector ty a -> Vector ty a
drop i :: Int
i v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (Int -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> v a -> v a
G.drop Int
i) Vector ty a
v
{-# INLINE splitAt #-}
splitAt :: SVECTOR ty a => Int -> Vector ty a -> (Vector ty a, Vector ty a)
splitAt :: Int -> Vector ty a -> (Vector ty a, Vector ty a)
splitAt i :: Int
i v :: Vector ty a
v = (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall a b. (a -> b) -> a -> b
$ (\(a :: W t ty a
a,b :: W t ty a
b) -> (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
a, W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
b)) ((W t ty a, W t ty a) -> (Vector ty a, Vector ty a))
-> (Proxy t -> (W t ty a, W t ty a))
-> Proxy t
-> (Vector ty a, Vector ty a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> (W t ty a, W t ty a))
-> Vector ty a -> Proxy t -> (W t ty a, W t ty a)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (Int -> W t ty a -> (W t ty a, W t ty a)
forall (v :: * -> *) a. Vector v a => Int -> v a -> (v a, v a)
G.splitAt Int
i) Vector ty a
v
unsafeSlice :: SVECTOR ty a => Int
-> Int
-> Vector ty a
-> Vector ty a
{-# INLINE unsafeSlice #-}
unsafeSlice :: Int -> Int -> Vector ty a -> Vector ty a
unsafeSlice i :: Int
i j :: Int
j v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (Int -> Int -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> Int -> v a -> v a
G.unsafeSlice Int
i Int
j) Vector ty a
v
unsafeInit :: SVECTOR ty a => Vector ty a -> Vector ty a
{-# INLINE unsafeInit #-}
unsafeInit :: Vector ty a -> Vector ty a
unsafeInit v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> v a
G.unsafeInit Vector ty a
v
unsafeTail :: SVECTOR ty a => Vector ty a -> Vector ty a
{-# INLINE unsafeTail #-}
unsafeTail :: Vector ty a -> Vector ty a
unsafeTail v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> v a
G.unsafeTail Vector ty a
v
unsafeTake :: SVECTOR ty a => Int -> Vector ty a -> Vector ty a
{-# INLINE unsafeTake #-}
unsafeTake :: Int -> Vector ty a -> Vector ty a
unsafeTake i :: Int
i v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (Int -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> v a -> v a
G.unsafeTake Int
i) Vector ty a
v
unsafeDrop :: SVECTOR ty a => Int -> Vector ty a -> Vector ty a
{-# INLINE unsafeDrop #-}
unsafeDrop :: Int -> Vector ty a -> Vector ty a
unsafeDrop i :: Int
i v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (Int -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> v a -> v a
G.unsafeDrop Int
i) Vector ty a
v
empty :: SVECTOR ty a => Vector ty a
{-# INLINE empty #-}
empty :: Vector ty a
empty = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW W t ty a
forall (v :: * -> *) a. Vector v a => v a
G.empty
singleton :: SVECTOR ty a => a -> Vector ty a
{-# INLINE singleton #-}
singleton :: a -> Vector ty a
singleton a :: a
a = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (a -> W t ty a
forall (v :: * -> *) a. Vector v a => a -> v a
G.singleton a
a)
replicate :: SVECTOR ty a => Int -> a -> Vector ty a
{-# INLINE replicate #-}
replicate :: Int -> a -> Vector ty a
replicate i :: Int
i v :: a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> a -> v a
G.replicate Int
i a
v)
generate :: SVECTOR ty a => Int -> (Int -> a) -> Vector ty a
{-# INLINE generate #-}
generate :: Int -> (Int -> a) -> Vector ty a
generate i :: Int
i f :: Int -> a
f = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> (Int -> a) -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> (Int -> a) -> v a
G.generate Int
i Int -> a
f)
iterateN :: SVECTOR ty a => Int -> (a -> a) -> a -> Vector ty a
{-# INLINE iterateN #-}
iterateN :: Int -> (a -> a) -> a -> Vector ty a
iterateN i :: Int
i f :: a -> a
f a :: a
a = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> (a -> a) -> a -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> (a -> a) -> a -> v a
G.iterateN Int
i a -> a
f a
a)
unfoldr :: SVECTOR ty a => (b -> Maybe (a, b)) -> b -> Vector ty a
{-# INLINE unfoldr #-}
unfoldr :: (b -> Maybe (a, b)) -> b -> Vector ty a
unfoldr g :: b -> Maybe (a, b)
g a :: b
a = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW ((b -> Maybe (a, b)) -> b -> W t ty a
forall (v :: * -> *) a b.
Vector v a =>
(b -> Maybe (a, b)) -> b -> v a
G.unfoldr b -> Maybe (a, b)
g b
a)
unfoldrN :: SVECTOR ty a => Int -> (b -> Maybe (a, b)) -> b -> Vector ty a
{-# INLINE unfoldrN #-}
unfoldrN :: Int -> (b -> Maybe (a, b)) -> b -> Vector ty a
unfoldrN n :: Int
n g :: b -> Maybe (a, b)
g a :: b
a = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> (b -> Maybe (a, b)) -> b -> W t ty a
forall (v :: * -> *) a b.
Vector v a =>
Int -> (b -> Maybe (a, b)) -> b -> v a
G.unfoldrN Int
n b -> Maybe (a, b)
g b
a)
constructN :: SVECTOR ty a => Int -> (Vector ty a -> a) -> Vector ty a
{-# INLINE constructN #-}
constructN :: Int -> (Vector ty a -> a) -> Vector ty a
constructN n :: Int
n g :: Vector ty a -> a
g = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> (W t ty a -> a) -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> (v a -> a) -> v a
G.constructN Int
n (Vector ty a -> a
g(Vector ty a -> a) -> (W t ty a -> Vector ty a) -> W t ty a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW))
constructrN :: SVECTOR ty a => Int -> (Vector ty a -> a) -> Vector ty a
{-# INLINE constructrN #-}
constructrN :: Int -> (Vector ty a -> a) -> Vector ty a
constructrN n :: Int
n g :: Vector ty a -> a
g = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> (W t ty a -> a) -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> (v a -> a) -> v a
G.constructrN Int
n (Vector ty a -> a
g(Vector ty a -> a) -> (W t ty a -> Vector ty a) -> W t ty a -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW))
enumFromN :: (SVECTOR ty a, Num a) => a -> Int -> Vector ty a
{-# INLINE enumFromN #-}
enumFromN :: a -> Int -> Vector ty a
enumFromN a :: a
a i :: Int
i = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (a -> Int -> W t ty a
forall (v :: * -> *) a. (Vector v a, Num a) => a -> Int -> v a
G.enumFromN a
a Int
i)
enumFromStepN :: (SVECTOR ty a, Num a) => a -> a -> Int -> Vector ty a
{-# INLINE enumFromStepN #-}
enumFromStepN :: a -> a -> Int -> Vector ty a
enumFromStepN f :: a
f t :: a
t s :: Int
s = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (a -> a -> Int -> W t ty a
forall (v :: * -> *) a. (Vector v a, Num a) => a -> a -> Int -> v a
G.enumFromStepN a
f a
t Int
s)
enumFromTo :: (SVECTOR ty a, Enum a) => a -> a -> Vector ty a
{-# INLINE enumFromTo #-}
enumFromTo :: a -> a -> Vector ty a
enumFromTo f :: a
f t :: a
t = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (a -> a -> W t ty a
forall (v :: * -> *) a. (Vector v a, Enum a) => a -> a -> v a
G.enumFromTo a
f a
t)
enumFromThenTo :: (SVECTOR ty a, Enum a) => a -> a -> a -> Vector ty a
{-# INLINE enumFromThenTo #-}
enumFromThenTo :: a -> a -> a -> Vector ty a
enumFromThenTo f :: a
f t :: a
t s :: a
s = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (a -> a -> a -> W t ty a
forall (v :: * -> *) a. (Vector v a, Enum a) => a -> a -> a -> v a
G.enumFromThenTo a
f a
t a
s)
cons :: SVECTOR ty a => a -> Vector ty a -> Vector ty a
{-# INLINE cons #-}
cons :: a -> Vector ty a -> Vector ty a
cons a :: a
a v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (a -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => a -> v a -> v a
G.cons a
a) Vector ty a
v
snoc :: SVECTOR ty a => Vector ty a -> a -> Vector ty a
{-# INLINE snoc #-}
snoc :: Vector ty a -> a -> Vector ty a
snoc v :: Vector ty a
v a :: a
a = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> a -> v a
`G.snoc` a
a) Vector ty a
v
infixr 5 ++
(++) :: SVECTOR ty a => Vector ty a -> Vector ty a -> Vector ty a
{-# INLINE (++) #-}
v1 :: Vector ty a
v1 ++ :: Vector ty a -> Vector ty a -> Vector ty a
++ v2 :: Vector ty a
v2 = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a -> W t ty a)
-> Vector ty a -> Vector ty a -> Proxy t -> W t ty a
forall t (tya :: SEXPTYPE) a (tyb :: SEXPTYPE) b r (p :: * -> *).
(W t tya a -> W t tyb b -> r)
-> Vector tya a -> Vector tyb b -> p t -> r
proxyFW2 W t ty a -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> v a -> v a
(G.++) Vector ty a
v1 Vector ty a
v2
concat :: SVECTOR ty a => [Vector ty a] -> Vector ty a
{-# INLINE concat #-}
concat :: [Vector ty a] -> Vector ty a
concat vs :: [Vector ty a]
vs = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a) -> W t ty a -> Vector ty a
forall a b. (a -> b) -> a -> b
$ [W t ty a] -> W t ty a
forall (v :: * -> *) a. Vector v a => [v a] -> v a
G.concat ([W t ty a] -> W t ty a) -> [W t ty a] -> W t ty a
forall a b. (a -> b) -> a -> b
$ (Vector ty a -> W t ty a) -> [Vector ty a] -> [W t ty a]
forall a b. (a -> b) -> [a] -> [b]
Prelude.map (Proxy t -> Vector ty a -> W t ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p) [Vector ty a]
vs
replicateM :: (Monad m, SVECTOR ty a) => Int -> m a -> m (Vector ty a)
{-# INLINE replicateM #-}
replicateM :: Int -> m a -> m (Vector ty a)
replicateM n :: Int
n f :: m a
f = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m (Vector ty a))
-> m (Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty a))
-> m (Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty a))
-> m (Vector ty a)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> (\v :: W t ty a
v -> W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW W t ty a
v Proxy t
p) (W t ty a -> Vector ty a) -> m (W t ty a) -> m (Vector ty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> m a -> m (W t ty a)
forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
Int -> m a -> m (v a)
G.replicateM Int
n m a
f
generateM :: (Monad m, SVECTOR ty a) => Int -> (Int -> m a) -> m (Vector ty a)
{-# INLINE generateM #-}
generateM :: Int -> (Int -> m a) -> m (Vector ty a)
generateM n :: Int
n f :: Int -> m a
f = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m (Vector ty a))
-> m (Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty a))
-> m (Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty a))
-> m (Vector ty a)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> (\v :: W t ty a
v -> W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW W t ty a
v Proxy t
p) (W t ty a -> Vector ty a) -> m (W t ty a) -> m (Vector ty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> (Int -> m a) -> m (W t ty a)
forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
Int -> (Int -> m a) -> m (v a)
G.generateM Int
n Int -> m a
f
create :: SVECTOR ty a => (forall r. ST r (MVector r ty a)) -> Vector ty a
{-# INLINE create #-}
create :: (forall r. ST r (MVector r ty a)) -> Vector ty a
create f :: forall r. ST r (MVector r ty a)
f = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a) -> W t ty a -> Vector ty a
forall a b. (a -> b) -> a -> b
$ (forall s. ST s (Mutable (W t ty) s a)) -> W t ty a
forall (v :: * -> *) a.
Vector v a =>
(forall s. ST s (Mutable v s a)) -> v a
G.create (Proxy t -> MVector s ty a -> W t ty s a
forall (proxy :: * -> *) t s (ty :: SEXPTYPE) a.
proxy t -> MVector s ty a -> W t ty s a
Mutable.withW Proxy t
p (MVector s ty a -> W t ty s a)
-> ST s (MVector s ty a) -> ST s (W t ty s a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ST s (MVector s ty a)
forall r. ST r (MVector r ty a)
f)
force :: SVECTOR ty a => Vector ty a -> Vector ty a
{-# INLINE force #-}
force :: Vector ty a -> Vector ty a
force v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> v a
G.force Vector ty a
v
(//) :: SVECTOR ty a
=> Vector ty a
-> [(Int, a)]
-> Vector ty a
{-# INLINE (//) #-}
// :: Vector ty a -> [(Int, a)] -> Vector ty a
(//) v :: Vector ty a
v l :: [(Int, a)]
l = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> [(Int, a)] -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> [(Int, a)] -> v a
G.// [(Int, a)]
l) Vector ty a
v
unsafeUpd :: SVECTOR ty a => Vector ty a -> [(Int, a)] -> Vector ty a
{-# INLINE unsafeUpd #-}
unsafeUpd :: Vector ty a -> [(Int, a)] -> Vector ty a
unsafeUpd v :: Vector ty a
v l :: [(Int, a)]
l = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> [(Int, a)] -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> [(Int, a)] -> v a
`G.unsafeUpd` [(Int, a)]
l) Vector ty a
v
accum :: SVECTOR ty a
=> (a -> b -> a)
-> Vector ty a
-> [(Int,b)]
-> Vector ty a
{-# INLINE accum #-}
accum :: (a -> b -> a) -> Vector ty a -> [(Int, b)] -> Vector ty a
accum f :: a -> b -> a
f v :: Vector ty a
v l :: [(Int, b)]
l = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (\w :: W t ty a
w -> (a -> b -> a) -> W t ty a -> [(Int, b)] -> W t ty a
forall (v :: * -> *) a b.
Vector v a =>
(a -> b -> a) -> v a -> [(Int, b)] -> v a
G.accum a -> b -> a
f W t ty a
w [(Int, b)]
l) Vector ty a
v
unsafeAccum :: SVECTOR ty a => (a -> b -> a) -> Vector ty a -> [(Int,b)] -> Vector ty a
{-# INLINE unsafeAccum #-}
unsafeAccum :: (a -> b -> a) -> Vector ty a -> [(Int, b)] -> Vector ty a
unsafeAccum f :: a -> b -> a
f v :: Vector ty a
v l :: [(Int, b)]
l = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (\w :: W t ty a
w -> (a -> b -> a) -> W t ty a -> [(Int, b)] -> W t ty a
forall (v :: * -> *) a b.
Vector v a =>
(a -> b -> a) -> v a -> [(Int, b)] -> v a
G.unsafeAccum a -> b -> a
f W t ty a
w [(Int, b)]
l) Vector ty a
v
reverse :: SVECTOR ty a => Vector ty a -> Vector ty a
{-# INLINE reverse #-}
reverse :: Vector ty a -> Vector ty a
reverse v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => v a -> v a
G.reverse Vector ty a
v
map :: (SVECTOR ty a, SVECTOR ty b) => (a -> b) -> Vector ty a -> Vector ty b
{-# INLINE map #-}
map :: (a -> b) -> Vector ty a -> Vector ty b
map f :: a -> b
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b) -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b) -> v a -> v b
G.map a -> b
f) Vector ty a
v
imap :: (SVECTOR ty a, SVECTOR ty b) => (Int -> a -> b) -> Vector ty a -> Vector ty b
{-# INLINE imap #-}
imap :: (Int -> a -> b) -> Vector ty a -> Vector ty b
imap f :: Int -> a -> b
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((Int -> a -> b) -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(Int -> a -> b) -> v a -> v b
G.imap Int -> a -> b
f) Vector ty a
v
concatMap :: (SVECTOR tya a, SVECTOR tyb b)
=> (a -> Vector tyb b)
-> Vector tya a
-> Vector tyb b
{-# INLINE concatMap #-}
#if MIN_VERSION_vector(0,11,0)
concatMap :: (a -> Vector tyb b) -> Vector tya a -> Vector tyb b
concatMap f :: a -> Vector tyb b
f v :: Vector tya a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyb b)
-> Vector tyb b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyb b)
-> Vector tyb b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyb b)
-> Vector tyb b
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let v' :: Bundle (W t tya) a
v' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
v)
in W t tyb b -> Proxy t -> Vector tyb b
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyb) b -> W t tyb b
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyb) b -> W t tyb b)
-> Bundle (W t tyb) b -> W t tyb b
forall a b. (a -> b) -> a -> b
$ Stream Id b -> Size -> Bundle (W t tyb) b
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream ((a -> Stream Id b) -> Stream Id a -> Stream Id b
forall (m :: * -> *) a b.
Monad m =>
(a -> Stream m b) -> Stream m a -> Stream m b
Stream.concatMap (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems (Bundle (W t tyb) b -> Stream Id b)
-> (a -> Bundle (W t tyb) b) -> a -> Stream Id b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (W t tyb b -> Bundle (W t tyb) b)
-> (a -> W t tyb b) -> a -> Bundle (W t tyb) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p (Vector tyb b -> W t tyb b)
-> (a -> Vector tyb b) -> a -> W t tyb b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Vector tyb b
f) (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
v')) Size
Unknown) Proxy t
p
#else
concatMap f v =
phony $ \p ->
(`proxyW` p) $
G.unstream $
Stream.concatMap (G.stream . withW p . f) $
G.stream $
withW p v
#endif
mapM :: (Monad m, SVECTOR ty a, SVECTOR ty b) => (a -> m b) -> Vector ty a -> m (Vector ty b)
{-# INLINE mapM #-}
mapM :: (a -> m b) -> Vector ty a -> m (Vector ty b)
mapM f :: a -> m b
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m (Vector ty b))
-> m (Vector ty b)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty b))
-> m (Vector ty b))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty b))
-> m (Vector ty b)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b) -> m (W t ty b) -> m (Vector ty b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (W t ty a -> m (W t ty b))
-> Vector ty a -> Proxy t -> m (W t ty b)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> m b) -> W t ty a -> m (W t ty b)
forall (m :: * -> *) (v :: * -> *) a b.
(Monad m, Vector v a, Vector v b) =>
(a -> m b) -> v a -> m (v b)
G.mapM a -> m b
f) Vector ty a
v Proxy t
p
mapM_ :: (Monad m, SVECTOR ty a) => (a -> m b) -> Vector ty a -> m ()
{-# INLINE mapM_ #-}
mapM_ :: (a -> m b) -> Vector ty a -> m ()
mapM_ f :: a -> m b
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ())
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m ()) -> Vector ty a -> Proxy t -> m ()
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> m b) -> W t ty a -> m ()
forall (m :: * -> *) (v :: * -> *) a b.
(Monad m, Vector v a) =>
(a -> m b) -> v a -> m ()
G.mapM_ a -> m b
f) Vector ty a
v
forM :: (Monad m, SVECTOR ty a, SVECTOR ty b) => Vector ty a -> (a -> m b) -> m (Vector ty b)
{-# INLINE forM #-}
forM :: Vector ty a -> (a -> m b) -> m (Vector ty b)
forM v :: Vector ty a
v f :: a -> m b
f = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m (Vector ty b))
-> m (Vector ty b)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty b))
-> m (Vector ty b))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty b))
-> m (Vector ty b)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b) -> m (W t ty b) -> m (Vector ty b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (W t ty a -> m (W t ty b))
-> Vector ty a -> Proxy t -> m (W t ty b)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> (a -> m b) -> m (W t ty b)
forall (m :: * -> *) (v :: * -> *) a b.
(Monad m, Vector v a, Vector v b) =>
v a -> (a -> m b) -> m (v b)
`G.forM` a -> m b
f) Vector ty a
v Proxy t
p
forM_ :: (Monad m, SVECTOR ty a) => Vector ty a -> (a -> m b) -> m ()
{-# INLINE forM_ #-}
forM_ :: Vector ty a -> (a -> m b) -> m ()
forM_ v :: Vector ty a
v f :: a -> m b
f = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ())
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m ()) -> Vector ty a -> Proxy t -> m ()
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (W t ty a -> (a -> m b) -> m ()
forall (m :: * -> *) (v :: * -> *) a b.
(Monad m, Vector v a) =>
v a -> (a -> m b) -> m ()
`G.forM_` a -> m b
f) Vector ty a
v
#if MIN_VERSION_vector(0,11,0)
smallest :: [Size] -> Size
smallest :: [Size] -> Size
smallest = (Size -> Size -> Size) -> [Size] -> Size
forall a. (a -> a -> a) -> [a] -> a
List.foldl1' Size -> Size -> Size
smaller
#endif
zipWith :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c)
=> (a -> b -> c) -> Vector tya a -> Vector tyb b -> Vector tyc c
{-# INLINE zipWith #-}
#if MIN_VERSION_vector(0,11,0)
zipWith :: (a -> b -> c) -> Vector tya a -> Vector tyb b -> Vector tyc c
zipWith f :: a -> b -> c
f xs :: Vector tya a
xs ys :: Vector tyb b
ys = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyc c)
-> Vector tyc c
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyc c)
-> Vector tyc c)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyc c)
-> Vector tyc c
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let xs' :: Bundle (W t tya) a
xs' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
xs)
ys' :: Bundle (W t tyb) b
ys' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
ys)
sz :: Size
sz = Size -> Size -> Size
smaller (Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
xs') (Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
ys')
in W t tyc c -> Proxy t -> Vector tyc c
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyc) c -> W t tyc c
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyc) c -> W t tyc c)
-> Bundle (W t tyc) c -> W t tyc c
forall a b. (a -> b) -> a -> b
$ Stream Id c -> Size -> Bundle (W t tyc) c
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream ((a -> b -> c) -> Stream Id a -> Stream Id b -> Stream Id c
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
Stream.zipWith a -> b -> c
f (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
xs') (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
ys')) Size
sz) Proxy t
p
#else
zipWith f xs ys = phony $ \p ->
proxyW (G.unstream (Stream.zipWith f (G.stream (withW p xs)) (G.stream (withW p ys)))) p
#endif
zipWith3 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d)
=> (a -> b -> c -> d) -> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d
{-# INLINE zipWith3 #-}
#if MIN_VERSION_vector(0,11,0)
zipWith3 :: (a -> b -> c -> d)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d
zipWith3 f :: a -> b -> c -> d
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyd d)
-> Vector tyd d
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyd d)
-> Vector tyd d)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyd d)
-> Vector tyd d
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
sz :: Size
sz = [Size] -> Size
smallest [Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs']
in W t tyd d -> Proxy t -> Vector tyd d
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyd) d -> W t tyd d
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyd) d -> W t tyd d)
-> Bundle (W t tyd) d -> W t tyd d
forall a b. (a -> b) -> a -> b
$ Stream Id d -> Size -> Bundle (W t tyd) d
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream ((a -> b -> c -> d)
-> Stream Id a -> Stream Id b -> Stream Id c -> Stream Id d
forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> d)
-> Stream m a -> Stream m b -> Stream m c -> Stream m d
Stream.zipWith3 a -> b -> c -> d
f (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as') (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs')) Size
sz) Proxy t
p
#else
zipWith3 f as bs cs = phony $ \p ->
proxyW (G.unstream (Stream.zipWith3 f (G.stream (withW p as)) (G.stream (withW p bs)) (G.stream (withW p cs)))) p
#endif
zipWith4 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d, SVECTOR tye e)
=> (a -> b -> c -> d -> e)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d -> Vector tye e
{-# INLINE zipWith4 #-}
#if MIN_VERSION_vector(0,11,0)
zipWith4 :: (a -> b -> c -> d -> e)
-> Vector tya a
-> Vector tyb b
-> Vector tyc c
-> Vector tyd d
-> Vector tye e
zipWith4 f :: a -> b -> c -> d -> e
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs ds :: Vector tyd d
ds = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tye e)
-> Vector tye e
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tye e)
-> Vector tye e)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tye e)
-> Vector tye e
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
ds' :: Bundle (W t tyd) d
ds' = W t tyd d -> Bundle (W t tyd) d
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyd d -> W t tyd d
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyd d
ds)
sz :: Size
sz = [Size] -> Size
smallest [Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs', Bundle (W t tyd) d -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyd) d
ds']
in W t tye e -> Proxy t -> Vector tye e
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tye) e -> W t tye e
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tye) e -> W t tye e)
-> Bundle (W t tye) e -> W t tye e
forall a b. (a -> b) -> a -> b
$ Stream Id e -> Size -> Bundle (W t tye) e
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream ((a -> b -> c -> d -> e)
-> Stream Id a
-> Stream Id b
-> Stream Id c
-> Stream Id d
-> Stream Id e
forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> e)
-> Stream m a
-> Stream m b
-> Stream m c
-> Stream m d
-> Stream m e
Stream.zipWith4 a -> b -> c -> d -> e
f (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as') (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs') (Bundle (W t tyd) d -> Stream Id d
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyd) d
ds')) Size
sz) Proxy t
p
#else
zipWith4 f as bs cs ds = phony $ \p ->
proxyW (G.unstream (Stream.zipWith4 f (G.stream (withW p as)) (G.stream (withW p bs)) (G.stream (withW p cs)) (G.stream (withW p ds)))) p
#endif
zipWith5 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d, SVECTOR tye e,
SVECTOR tyf f)
=> (a -> b -> c -> d -> e -> f)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d -> Vector tye e
-> Vector tyf f
{-# INLINE zipWith5 #-}
#if MIN_VERSION_vector(0,11,0)
zipWith5 :: (a -> b -> c -> d -> e -> f)
-> Vector tya a
-> Vector tyb b
-> Vector tyc c
-> Vector tyd d
-> Vector tye e
-> Vector tyf f
zipWith5 f :: a -> b -> c -> d -> e -> f
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs ds :: Vector tyd d
ds es :: Vector tye e
es = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyf f)
-> Vector tyf f
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyf f)
-> Vector tyf f)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyf f)
-> Vector tyf f
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
ds' :: Bundle (W t tyd) d
ds' = W t tyd d -> Bundle (W t tyd) d
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyd d -> W t tyd d
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyd d
ds)
es' :: Bundle (W t tye) e
es' = W t tye e -> Bundle (W t tye) e
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tye e -> W t tye e
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tye e
es)
sz :: Size
sz = [Size] -> Size
smallest [Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs', Bundle (W t tyd) d -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyd) d
ds', Bundle (W t tye) e -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tye) e
es']
in W t tyf f -> Proxy t -> Vector tyf f
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyf) f -> W t tyf f
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyf) f -> W t tyf f)
-> Bundle (W t tyf) f -> W t tyf f
forall a b. (a -> b) -> a -> b
$ Stream Id f -> Size -> Bundle (W t tyf) f
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream ((a -> b -> c -> d -> e -> f)
-> Stream Id a
-> Stream Id b
-> Stream Id c
-> Stream Id d
-> Stream Id e
-> Stream Id f
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> f)
-> Stream m a
-> Stream m b
-> Stream m c
-> Stream m d
-> Stream m e
-> Stream m f
Stream.zipWith5 a -> b -> c -> d -> e -> f
f (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as') (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs') (Bundle (W t tyd) d -> Stream Id d
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyd) d
ds') (Bundle (W t tye) e -> Stream Id e
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tye) e
es')) Size
sz) Proxy t
p
#else
zipWith5 f as bs cs ds es = phony $ \p ->
proxyW (G.unstream (Stream.zipWith5 f (G.stream (withW p as)) (G.stream (withW p bs)) (G.stream (withW p cs)) (G.stream (withW p ds)) (G.stream (withW p es)))) p
#endif
zipWith6 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d, SVECTOR tye e,
SVECTOR tyf f, SVECTOR tyg g)
=> (a -> b -> c -> d -> e -> f -> g)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d -> Vector tye e
-> Vector tyf f -> Vector tyg g
{-# INLINE zipWith6 #-}
#if MIN_VERSION_vector(0,11,0)
zipWith6 :: (a -> b -> c -> d -> e -> f -> g)
-> Vector tya a
-> Vector tyb b
-> Vector tyc c
-> Vector tyd d
-> Vector tye e
-> Vector tyf f
-> Vector tyg g
zipWith6 f :: a -> b -> c -> d -> e -> f -> g
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs ds :: Vector tyd d
ds es :: Vector tye e
es fs :: Vector tyf f
fs = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyg g)
-> Vector tyg g
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyg g)
-> Vector tyg g)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyg g)
-> Vector tyg g
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
ds' :: Bundle (W t tyd) d
ds' = W t tyd d -> Bundle (W t tyd) d
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyd d -> W t tyd d
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyd d
ds)
es' :: Bundle (W t tye) e
es' = W t tye e -> Bundle (W t tye) e
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tye e -> W t tye e
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tye e
es)
fs' :: Bundle (W t tyf) f
fs' = W t tyf f -> Bundle (W t tyf) f
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyf f -> W t tyf f
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyf f
fs)
sz :: Size
sz = [Size] -> Size
smallest [Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs', Bundle (W t tyd) d -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyd) d
ds', Bundle (W t tye) e -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tye) e
es', Bundle (W t tyf) f -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyf) f
fs']
in W t tyg g -> Proxy t -> Vector tyg g
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyg) g -> W t tyg g
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyg) g -> W t tyg g)
-> Bundle (W t tyg) g -> W t tyg g
forall a b. (a -> b) -> a -> b
$ Stream Id g -> Size -> Bundle (W t tyg) g
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream ((a -> b -> c -> d -> e -> f -> g)
-> Stream Id a
-> Stream Id b
-> Stream Id c
-> Stream Id d
-> Stream Id e
-> Stream Id f
-> Stream Id g
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> g)
-> Stream m a
-> Stream m b
-> Stream m c
-> Stream m d
-> Stream m e
-> Stream m f
-> Stream m g
Stream.zipWith6 a -> b -> c -> d -> e -> f -> g
f (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as') (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs') (Bundle (W t tyd) d -> Stream Id d
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyd) d
ds') (Bundle (W t tye) e -> Stream Id e
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tye) e
es') (Bundle (W t tyf) f -> Stream Id f
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyf) f
fs')) Size
sz) Proxy t
p
#else
zipWith6 f as bs cs ds es fs = phony $ \p ->
proxyW (G.unstream (Stream.zipWith6 f (G.stream (withW p as)) (G.stream (withW p bs)) (G.stream (withW p cs)) (G.stream (withW p ds)) (G.stream (withW p es)) (G.stream (withW p fs)))) p
#endif
izipWith :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c)
=> (Int -> a -> b -> c) -> Vector tya a -> Vector tyb b -> Vector tyc c
{-# INLINE izipWith #-}
#if MIN_VERSION_vector(0,11,0)
izipWith :: (Int -> a -> b -> c)
-> Vector tya a -> Vector tyb b -> Vector tyc c
izipWith f :: Int -> a -> b -> c
f as :: Vector tya a
as bs :: Vector tyb b
bs = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyc c)
-> Vector tyc c
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyc c)
-> Vector tyc c)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyc c)
-> Vector tyc c
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
sz :: Size
sz = Size -> Size -> Size
smaller (Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as') (Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs')
in W t tyc c -> Proxy t -> Vector tyc c
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyc) c -> W t tyc c
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyc) c -> W t tyc c)
-> Bundle (W t tyc) c -> W t tyc c
forall a b. (a -> b) -> a -> b
$ Stream Id c -> Size -> Bundle (W t tyc) c
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream (((Int, a) -> b -> c)
-> Stream Id (Int, a) -> Stream Id b -> Stream Id c
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
Stream.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) (Stream Id a -> Stream Id (Int, a)
forall (m :: * -> *) a. Monad m => Stream m a -> Stream m (Int, a)
Stream.indexed (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as')) (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs')) Size
sz) Proxy t
p
#else
izipWith f as bs = phony $ \p ->
proxyW (G.unstream (Stream.zipWith (uncurry f) (Stream.indexed (G.stream (withW p as))) (G.stream (withW p bs)))) p
#endif
izipWith3 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d)
=> (Int -> a -> b -> c -> d)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d
{-# INLINE izipWith3 #-}
#if MIN_VERSION_vector(0,11,0)
izipWith3 :: (Int -> a -> b -> c -> d)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d
izipWith3 f :: Int -> a -> b -> c -> d
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyd d)
-> Vector tyd d
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyd d)
-> Vector tyd d)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyd d)
-> Vector tyd d
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
sz :: Size
sz = [Size] -> Size
smallest [Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs']
in W t tyd d -> Proxy t -> Vector tyd d
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyd) d -> W t tyd d
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyd) d -> W t tyd d)
-> Bundle (W t tyd) d -> W t tyd d
forall a b. (a -> b) -> a -> b
$ Stream Id d -> Size -> Bundle (W t tyd) d
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream (((Int, a) -> b -> c -> d)
-> Stream Id (Int, a) -> Stream Id b -> Stream Id c -> Stream Id d
forall (m :: * -> *) a b c d.
Monad m =>
(a -> b -> c -> d)
-> Stream m a -> Stream m b -> Stream m c -> Stream m d
Stream.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) (Stream Id a -> Stream Id (Int, a)
forall (m :: * -> *) a. Monad m => Stream m a -> Stream m (Int, a)
Stream.indexed (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as')) (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs')) Size
sz) Proxy t
p
#else
izipWith3 f as bs cs = phony $ \p ->
proxyW (G.unstream (Stream.zipWith3 (uncurry f) (Stream.indexed (G.stream (withW p as))) (G.stream (withW p bs)) (G.stream (withW p cs)))) p
#endif
izipWith4 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d, SVECTOR tye e)
=> (Int -> a -> b -> c -> d -> e)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d -> Vector tye e
{-# INLINE izipWith4 #-}
#if MIN_VERSION_vector(0,11,0)
izipWith4 :: (Int -> a -> b -> c -> d -> e)
-> Vector tya a
-> Vector tyb b
-> Vector tyc c
-> Vector tyd d
-> Vector tye e
izipWith4 f :: Int -> a -> b -> c -> d -> e
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs ds :: Vector tyd d
ds = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tye e)
-> Vector tye e
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tye e)
-> Vector tye e)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tye e)
-> Vector tye e
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
ds' :: Bundle (W t tyd) d
ds' = W t tyd d -> Bundle (W t tyd) d
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyd d -> W t tyd d
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyd d
ds)
sz :: Size
sz = [Size] -> Size
smallest [ Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs', Bundle (W t tyd) d -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyd) d
ds']
in W t tye e -> Proxy t -> Vector tye e
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tye) e -> W t tye e
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tye) e -> W t tye e)
-> Bundle (W t tye) e -> W t tye e
forall a b. (a -> b) -> a -> b
$ Stream Id e -> Size -> Bundle (W t tye) e
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream (((Int, a) -> b -> c -> d -> e)
-> Stream Id (Int, a)
-> Stream Id b
-> Stream Id c
-> Stream Id d
-> Stream Id e
forall (m :: * -> *) a b c d e.
Monad m =>
(a -> b -> c -> d -> e)
-> Stream m a
-> Stream m b
-> Stream m c
-> Stream m d
-> Stream m e
Stream.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) (Stream Id a -> Stream Id (Int, a)
forall (m :: * -> *) a. Monad m => Stream m a -> Stream m (Int, a)
Stream.indexed (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as')) (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs') (Bundle (W t tyd) d -> Stream Id d
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyd) d
ds')) Size
sz) Proxy t
p
#else
izipWith4 f as bs cs ds = phony $ \p ->
proxyW (G.unstream (Stream.zipWith4 (uncurry f) (Stream.indexed (G.stream (withW p as))) (G.stream (withW p bs)) (G.stream (withW p cs)) (G.stream (withW p ds)))) p
#endif
izipWith5 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d, SVECTOR tye e,
SVECTOR tyf f)
=> (Int -> a -> b -> c -> d -> e -> f)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d -> Vector tye e
-> Vector tyf f
{-# INLINE izipWith5 #-}
#if MIN_VERSION_vector(0,11,0)
izipWith5 :: (Int -> a -> b -> c -> d -> e -> f)
-> Vector tya a
-> Vector tyb b
-> Vector tyc c
-> Vector tyd d
-> Vector tye e
-> Vector tyf f
izipWith5 f :: Int -> a -> b -> c -> d -> e -> f
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs ds :: Vector tyd d
ds es :: Vector tye e
es = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyf f)
-> Vector tyf f
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyf f)
-> Vector tyf f)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyf f)
-> Vector tyf f
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
ds' :: Bundle (W t tyd) d
ds' = W t tyd d -> Bundle (W t tyd) d
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyd d -> W t tyd d
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyd d
ds)
es' :: Bundle (W t tye) e
es' = W t tye e -> Bundle (W t tye) e
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tye e -> W t tye e
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tye e
es)
sz :: Size
sz = [Size] -> Size
smallest [ Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs', Bundle (W t tyd) d -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyd) d
ds', Bundle (W t tye) e -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tye) e
es']
in W t tyf f -> Proxy t -> Vector tyf f
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyf) f -> W t tyf f
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyf) f -> W t tyf f)
-> Bundle (W t tyf) f -> W t tyf f
forall a b. (a -> b) -> a -> b
$ Stream Id f -> Size -> Bundle (W t tyf) f
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream (((Int, a) -> b -> c -> d -> e -> f)
-> Stream Id (Int, a)
-> Stream Id b
-> Stream Id c
-> Stream Id d
-> Stream Id e
-> Stream Id f
forall (m :: * -> *) a b c d e f.
Monad m =>
(a -> b -> c -> d -> e -> f)
-> Stream m a
-> Stream m b
-> Stream m c
-> Stream m d
-> Stream m e
-> Stream m f
Stream.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) (Stream Id a -> Stream Id (Int, a)
forall (m :: * -> *) a. Monad m => Stream m a -> Stream m (Int, a)
Stream.indexed (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as')) (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs') (Bundle (W t tyd) d -> Stream Id d
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyd) d
ds') (Bundle (W t tye) e -> Stream Id e
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tye) e
es')) Size
sz) Proxy t
p
#else
izipWith5 f as bs cs ds es = phony $ \p ->
proxyW (G.unstream (Stream.zipWith5 (uncurry f) (Stream.indexed (G.stream (withW p as))) (G.stream (withW p bs)) (G.stream (withW p cs)) (G.stream (withW p ds)) (G.stream (withW p es)))) p
#endif
izipWith6 :: (SVECTOR tya a, SVECTOR tyb b, SVECTOR tyc c, SVECTOR tyd d, SVECTOR tye e,
SVECTOR tyf f, SVECTOR tyg g)
=> (Int -> a -> b -> c -> d -> e -> f -> g)
-> Vector tya a -> Vector tyb b -> Vector tyc c -> Vector tyd d -> Vector tye e
-> Vector tyf f -> Vector tyg g
{-# INLINE izipWith6 #-}
#if MIN_VERSION_vector(0,11,0)
izipWith6 :: (Int -> a -> b -> c -> d -> e -> f -> g)
-> Vector tya a
-> Vector tyb b
-> Vector tyc c
-> Vector tyd d
-> Vector tye e
-> Vector tyf f
-> Vector tyg g
izipWith6 f :: Int -> a -> b -> c -> d -> e -> f -> g
f as :: Vector tya a
as bs :: Vector tyb b
bs cs :: Vector tyc c
cs ds :: Vector tyd d
ds es :: Vector tye e
es fs :: Vector tyf f
fs = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyg g)
-> Vector tyg g
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyg g)
-> Vector tyg g)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector tyg g)
-> Vector tyg g
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let as' :: Bundle (W t tya) a
as' = W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
as)
bs' :: Bundle (W t tyb) b
bs' = W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
bs)
cs' :: Bundle (W t tyc) c
cs' = W t tyc c -> Bundle (W t tyc) c
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyc c -> W t tyc c
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyc c
cs)
ds' :: Bundle (W t tyd) d
ds' = W t tyd d -> Bundle (W t tyd) d
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyd d -> W t tyd d
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyd d
ds)
es' :: Bundle (W t tye) e
es' = W t tye e -> Bundle (W t tye) e
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tye e -> W t tye e
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tye e
es)
fs' :: Bundle (W t tyf) f
fs' = W t tyf f -> Bundle (W t tyf) f
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyf f -> W t tyf f
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyf f
fs)
sz :: Size
sz = [Size] -> Size
smallest [ Bundle (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tya) a
as', Bundle (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyb) b
bs', Bundle (W t tyc) c -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyc) c
cs', Bundle (W t tyd) d -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyd) d
ds', Bundle (W t tye) e -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tye) e
es', Bundle (W t tyf) f -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle (W t tyf) f
fs']
in W t tyg g -> Proxy t -> Vector tyg g
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Bundle (W t tyg) g -> W t tyg g
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Bundle (W t tyg) g -> W t tyg g)
-> Bundle (W t tyg) g -> W t tyg g
forall a b. (a -> b) -> a -> b
$ Stream Id g -> Size -> Bundle (W t tyg) g
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Stream m a -> Size -> Bundle m v a
Bundle.fromStream (((Int, a) -> b -> c -> d -> e -> f -> g)
-> Stream Id (Int, a)
-> Stream Id b
-> Stream Id c
-> Stream Id d
-> Stream Id e
-> Stream Id f
-> Stream Id g
forall (m :: * -> *) a b c d e f g.
Monad m =>
(a -> b -> c -> d -> e -> f -> g)
-> Stream m a
-> Stream m b
-> Stream m c
-> Stream m d
-> Stream m e
-> Stream m f
-> Stream m g
Stream.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) (Stream Id a -> Stream Id (Int, a)
forall (m :: * -> *) a. Monad m => Stream m a -> Stream m (Int, a)
Stream.indexed (Bundle (W t tya) a -> Stream Id a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tya) a
as')) (Bundle (W t tyb) b -> Stream Id b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyb) b
bs') (Bundle (W t tyc) c -> Stream Id c
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyc) c
cs') (Bundle (W t tyd) d -> Stream Id d
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyd) d
ds') (Bundle (W t tye) e -> Stream Id e
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tye) e
es') (Bundle (W t tyf) f -> Stream Id f
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle (W t tyf) f
fs')) Size
sz) Proxy t
p
#else
izipWith6 f as bs cs ds es fs = phony $ \p ->
proxyW (G.unstream (Stream.zipWith6 (uncurry f) (Stream.indexed (G.stream (withW p as))) (G.stream (withW p bs)) (G.stream (withW p cs)) (G.stream (withW p ds)) (G.stream (withW p es)) (G.stream (withW p fs)))) p
#endif
zipWithM :: (MonadR m, VECTOR (Region m) tya a, VECTOR (Region m) tyb b, VECTOR (Region m) tyc c, ElemRep V tya ~ a, ElemRep V tyb ~ b, ElemRep V tyc ~ c)
=> (a -> b -> m c)
-> Vector tya a
-> Vector tyb b
-> m (Vector tyc c)
{-# INLINE zipWithM #-}
#if MIN_VERSION_vector(0,11,0)
zipWithM :: (a -> b -> m c) -> Vector tya a -> Vector tyb b -> m (Vector tyc c)
zipWithM f :: a -> b -> m c
f xs :: Vector tya a
xs ys :: Vector tyb b
ys = (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector tyc c))
-> m (Vector tyc c)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector tyc c))
-> m (Vector tyc c))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector tyc c))
-> m (Vector tyc c)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let xs' :: Bundle m (W t tya) a
xs' = Bundle (W t tya) a -> Bundle m (W t tya) a
forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle v a -> Bundle m v a
lift (Bundle (W t tya) a -> Bundle m (W t tya) a)
-> Bundle (W t tya) a -> Bundle m (W t tya) a
forall a b. (a -> b) -> a -> b
$ W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
xs)
ys' :: Bundle m (W t tyb) b
ys' = Bundle (W t tyb) b -> Bundle m (W t tyb) b
forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle v a -> Bundle m v a
lift (Bundle (W t tyb) b -> Bundle m (W t tyb) b)
-> Bundle (W t tyb) b -> Bundle m (W t tyb) b
forall a b. (a -> b) -> a -> b
$ W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
ys)
sz :: Size
sz = Size -> Size -> Size
smaller (Bundle m (W t tya) a -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle m (W t tya) a
xs') (Bundle m (W t tyb) b -> Size
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Size
sSize Bundle m (W t tyb) b
ys')
in W t tyc c -> Proxy t -> Vector tyc c
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (W t tyc c -> Proxy t -> Vector tyc c)
-> m (W t tyc c) -> m (Proxy t -> Vector tyc c)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Bundle (W t tyc) c -> W t tyc c)
-> m (Bundle (W t tyc) c) -> m (W t tyc c)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.fmap Bundle (W t tyc) c -> W t tyc c
forall (v :: * -> *) a. Vector v a => Bundle v a -> v a
G.unstream (Size -> [c] -> Bundle (W t tyc) c
forall (m :: * -> *) a (v :: * -> *).
Monad m =>
Size -> [a] -> Bundle m v a
Bundle.unsafeFromList Size
sz ([c] -> Bundle (W t tyc) c) -> m [c] -> m (Bundle (W t tyc) c)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Stream m c -> m [c]
forall (m :: * -> *) a. Monad m => Stream m a -> m [a]
Stream.toList ((a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Stream m a -> Stream m b -> Stream m c
Stream.zipWithM a -> b -> m c
f (Bundle m (W t tya) a -> Stream m a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle m (W t tya) a
xs') (Bundle m (W t tyb) b -> Stream m b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle m (W t tyb) b
ys')))
m (Proxy t -> Vector tyc c) -> m (Proxy t) -> m (Vector tyc c)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy t -> m (Proxy t)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Proxy t
p
#else
zipWithM f xs ys = phony $ \p ->
proxyW <$>
unstreamM (Stream.zipWithM f (G.stream (withW p xs)) (G.stream (withW p ys))) <*>
return p
where
unstreamM s = do
zs <- MStream.toList s
return $ G.unstream $ Stream.unsafeFromList (MStream.size s) zs
#endif
zipWithM_ :: (Monad m, SVECTOR tya a, SVECTOR tyb b)
=> (a -> b -> m c)
-> Vector tya a
-> Vector tyb b
-> m ()
{-# INLINE zipWithM_ #-}
#if MIN_VERSION_vector(0,11,0)
zipWithM_ :: (a -> b -> m c) -> Vector tya a -> Vector tyb b -> m ()
zipWithM_ f :: a -> b -> m c
f xs :: Vector tya a
xs ys :: Vector tyb b
ys = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ())
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p ->
let xs' :: Bundle m (W t tya) a
xs' = Bundle (W t tya) a -> Bundle m (W t tya) a
forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle v a -> Bundle m v a
lift (Bundle (W t tya) a -> Bundle m (W t tya) a)
-> Bundle (W t tya) a -> Bundle m (W t tya) a
forall a b. (a -> b) -> a -> b
$ W t tya a -> Bundle (W t tya) a
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tya a -> W t tya a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tya a
xs)
ys' :: Bundle m (W t tyb) b
ys' = Bundle (W t tyb) b -> Bundle m (W t tyb) b
forall (m :: * -> *) (v :: * -> *) a.
Monad m =>
Bundle v a -> Bundle m v a
lift (Bundle (W t tyb) b -> Bundle m (W t tyb) b)
-> Bundle (W t tyb) b -> Bundle m (W t tyb) b
forall a b. (a -> b) -> a -> b
$ W t tyb b -> Bundle (W t tyb) b
forall (v :: * -> *) a. Vector v a => v a -> Bundle v a
G.stream (Proxy t -> Vector tyb b -> W t tyb b
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector tyb b
ys)
in (a -> b -> m c) -> Stream m a -> Stream m b -> m ()
forall (m :: * -> *) a b c.
Monad m =>
(a -> b -> m c) -> Stream m a -> Stream m b -> m ()
Stream.zipWithM_ a -> b -> m c
f (Bundle m (W t tya) a -> Stream m a
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle m (W t tya) a
xs') (Bundle m (W t tyb) b -> Stream m b
forall (m :: * -> *) (v :: * -> *) a. Bundle m v a -> Stream m a
sElems Bundle m (W t tyb) b
ys')
#else
zipWithM_ f xs ys = phony $ \p ->
Stream.zipWithM_ f (G.stream (withW p xs)) (G.stream (withW p ys))
#endif
filter :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> Vector ty a
{-# INLINE filter #-}
filter :: (a -> Bool) -> Vector ty a -> Vector ty a
filter f :: a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => (a -> Bool) -> v a -> v a
G.filter a -> Bool
f) Vector ty a
v
ifilter :: SVECTOR ty a => (Int -> a -> Bool) -> Vector ty a -> Vector ty a
{-# INLINE ifilter #-}
ifilter :: (Int -> a -> Bool) -> Vector ty a -> Vector ty a
ifilter f :: Int -> a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((Int -> a -> Bool) -> W t ty a -> W t ty a
forall (v :: * -> *) a.
Vector v a =>
(Int -> a -> Bool) -> v a -> v a
G.ifilter Int -> a -> Bool
f) Vector ty a
v
filterM :: (Monad m, SVECTOR ty a) => (a -> m Bool) -> Vector ty a -> m (Vector ty a)
{-# INLINE filterM #-}
filterM :: (a -> m Bool) -> Vector ty a -> m (Vector ty a)
filterM f :: a -> m Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m (Vector ty a))
-> m (Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty a))
-> m (Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> m (Vector ty a))
-> m (Vector ty a)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a) -> m (W t ty a) -> m (Vector ty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (W t ty a -> m (W t ty a))
-> Vector ty a -> Proxy t -> m (W t ty a)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> m Bool) -> W t ty a -> m (W t ty a)
forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
(a -> m Bool) -> v a -> m (v a)
G.filterM a -> m Bool
f) Vector ty a
v Proxy t
p
takeWhile :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> Vector ty a
{-# INLINE takeWhile #-}
takeWhile :: (a -> Bool) -> Vector ty a -> Vector ty a
takeWhile f :: a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => (a -> Bool) -> v a -> v a
G.takeWhile a -> Bool
f) Vector ty a
v
dropWhile :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> Vector ty a
{-# INLINE dropWhile #-}
dropWhile :: (a -> Bool) -> Vector ty a -> Vector ty a
dropWhile f :: a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => (a -> Bool) -> v a -> v a
G.dropWhile a -> Bool
f) Vector ty a
v
partition :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
{-# INLINE partition #-}
partition :: (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
partition f :: a -> Bool
f v :: Vector ty a
v = (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall a b. (a -> b) -> a -> b
$ (\(a :: W t ty a
a,b :: W t ty a
b) -> (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
a, W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
b)) ((W t ty a, W t ty a) -> (Vector ty a, Vector ty a))
-> (Proxy t -> (W t ty a, W t ty a))
-> Proxy t
-> (Vector ty a, Vector ty a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> (W t ty a, W t ty a))
-> Vector ty a -> Proxy t -> (W t ty a, W t ty a)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> (W t ty a, W t ty a)
forall (v :: * -> *) a.
Vector v a =>
(a -> Bool) -> v a -> (v a, v a)
G.partition a -> Bool
f) Vector ty a
v
unstablePartition :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
{-# INLINE unstablePartition #-}
unstablePartition :: (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
unstablePartition f :: a -> Bool
f v :: Vector ty a
v = (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall a b. (a -> b) -> a -> b
$ (\(a :: W t ty a
a,b :: W t ty a
b) -> (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
a, W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
b)) ((W t ty a, W t ty a) -> (Vector ty a, Vector ty a))
-> (Proxy t -> (W t ty a, W t ty a))
-> Proxy t
-> (Vector ty a, Vector ty a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> (W t ty a, W t ty a))
-> Vector ty a -> Proxy t -> (W t ty a, W t ty a)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> (W t ty a, W t ty a)
forall (v :: * -> *) a.
Vector v a =>
(a -> Bool) -> v a -> (v a, v a)
G.unstablePartition a -> Bool
f) Vector ty a
v
span :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
{-# INLINE span #-}
span :: (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
span f :: a -> Bool
f v :: Vector ty a
v = (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall a b. (a -> b) -> a -> b
$ (\(a :: W t ty a
a,b :: W t ty a
b) -> (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
a, W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
b)) ((W t ty a, W t ty a) -> (Vector ty a, Vector ty a))
-> (Proxy t -> (W t ty a, W t ty a))
-> Proxy t
-> (Vector ty a, Vector ty a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> (W t ty a, W t ty a))
-> Vector ty a -> Proxy t -> (W t ty a, W t ty a)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> (W t ty a, W t ty a)
forall (v :: * -> *) a.
Vector v a =>
(a -> Bool) -> v a -> (v a, v a)
G.span a -> Bool
f) Vector ty a
v
break :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
{-# INLINE break #-}
break :: (a -> Bool) -> Vector ty a -> (Vector ty a, Vector ty a)
break f :: a -> Bool
f v :: Vector ty a
v = (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a))
-> (forall t.
Reifies t (AcquireIO Any) =>
Proxy t -> (Vector ty a, Vector ty a))
-> (Vector ty a, Vector ty a)
forall a b. (a -> b) -> a -> b
$ (\(a :: W t ty a
a,b :: W t ty a
b) -> (W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
a, W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW W t ty a
b)) ((W t ty a, W t ty a) -> (Vector ty a, Vector ty a))
-> (Proxy t -> (W t ty a, W t ty a))
-> Proxy t
-> (Vector ty a, Vector ty a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> (W t ty a, W t ty a))
-> Vector ty a -> Proxy t -> (W t ty a, W t ty a)
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> (W t ty a, W t ty a)
forall (v :: * -> *) a.
Vector v a =>
(a -> Bool) -> v a -> (v a, v a)
G.break a -> Bool
f) Vector ty a
v
infix 4 `elem`
elem :: (SVECTOR ty a, Eq a) => a -> Vector ty a -> Bool
{-# INLINE elem #-}
elem :: a -> Vector ty a -> Bool
elem a :: a
a v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Bool) -> Vector ty a -> Proxy t -> Bool
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (a -> W t ty a -> Bool
forall (v :: * -> *) a. (Vector v a, Eq a) => a -> v a -> Bool
G.elem a
a) Vector ty a
v
infix 4 `notElem`
notElem :: (SVECTOR ty a, Eq a) => a -> Vector ty a -> Bool
{-# INLINE notElem #-}
notElem :: a -> Vector ty a -> Bool
notElem a :: a
a v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Bool) -> Vector ty a -> Proxy t -> Bool
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (a -> W t ty a -> Bool
forall (v :: * -> *) a. (Vector v a, Eq a) => a -> v a -> Bool
G.notElem a
a) Vector ty a
v
find :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> Maybe a
{-# INLINE find #-}
find :: (a -> Bool) -> Vector ty a -> Maybe a
find f :: a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe a)
-> Maybe a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe a)
-> Maybe a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe a)
-> Maybe a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Maybe a) -> Vector ty a -> Proxy t -> Maybe a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> Maybe a
forall (v :: * -> *) a. Vector v a => (a -> Bool) -> v a -> Maybe a
G.find a -> Bool
f) Vector ty a
v
findIndex :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> Maybe Int
{-# INLINE findIndex #-}
findIndex :: (a -> Bool) -> Vector ty a -> Maybe Int
findIndex f :: a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe Int)
-> Maybe Int
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe Int)
-> Maybe Int)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe Int)
-> Maybe Int
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Maybe Int) -> Vector ty a -> Proxy t -> Maybe Int
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Bool) -> W t ty a -> Maybe Int
forall (v :: * -> *) a.
Vector v a =>
(a -> Bool) -> v a -> Maybe Int
G.findIndex a -> Bool
f) Vector ty a
v
elemIndex :: (SVECTOR ty a, Eq a) => a -> Vector ty a -> Maybe Int
{-# INLINE elemIndex #-}
elemIndex :: a -> Vector ty a -> Maybe Int
elemIndex a :: a
a v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe Int)
-> Maybe Int
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe Int)
-> Maybe Int)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Maybe Int)
-> Maybe Int
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Maybe Int) -> Vector ty a -> Proxy t -> Maybe Int
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW (a -> W t ty a -> Maybe Int
forall (v :: * -> *) a. (Vector v a, Eq a) => a -> v a -> Maybe Int
G.elemIndex a
a) Vector ty a
v
foldl :: SVECTOR ty b => (a -> b -> a) -> a -> Vector ty b -> a
{-# INLINE foldl #-}
foldl :: (a -> b -> a) -> a -> Vector ty b -> a
foldl f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty b -> a) -> Vector ty b -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> a
forall (v :: * -> *) b a.
Vector v b =>
(a -> b -> a) -> a -> v b -> a
G.foldl a -> b -> a
f a
s) Vector ty b
v
foldl1 :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> a
{-# INLINE foldl1 #-}
foldl1 :: (a -> a -> a) -> Vector ty a -> a
foldl1 f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> a
G.foldl1 a -> a -> a
f) Vector ty a
v
foldl' :: SVECTOR ty b => (a -> b -> a) -> a -> Vector ty b -> a
{-# INLINE foldl' #-}
foldl' :: (a -> b -> a) -> a -> Vector ty b -> a
foldl' f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty b -> a) -> Vector ty b -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> a
forall (v :: * -> *) b a.
Vector v b =>
(a -> b -> a) -> a -> v b -> a
G.foldl' a -> b -> a
f a
s) Vector ty b
v
foldl1' :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> a
{-# INLINE foldl1' #-}
foldl1' :: (a -> a -> a) -> Vector ty a -> a
foldl1' f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> a
G.foldl1' a -> a -> a
f) Vector ty a
v
foldr :: SVECTOR ty a => (a -> b -> b) -> b -> Vector ty a -> b
{-# INLINE foldr #-}
foldr :: (a -> b -> b) -> b -> Vector ty a -> b
foldr f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall a b. (a -> b) -> a -> b
$ (W t ty a -> b) -> Vector ty a -> Proxy t -> b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> b
forall (v :: * -> *) a b.
Vector v a =>
(a -> b -> b) -> b -> v a -> b
G.foldr a -> b -> b
f b
s) Vector ty a
v
foldr1 :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> a
{-# INLINE foldr1 #-}
foldr1 :: (a -> a -> a) -> Vector ty a -> a
foldr1 f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> a
G.foldr1 a -> a -> a
f) Vector ty a
v
foldr' :: SVECTOR ty a => (a -> b -> b) -> b -> Vector ty a -> b
{-# INLINE foldr' #-}
foldr' :: (a -> b -> b) -> b -> Vector ty a -> b
foldr' f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall a b. (a -> b) -> a -> b
$ (W t ty a -> b) -> Vector ty a -> Proxy t -> b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> b
forall (v :: * -> *) a b.
Vector v a =>
(a -> b -> b) -> b -> v a -> b
G.foldr' a -> b -> b
f b
s) Vector ty a
v
foldr1' :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> a
{-# INLINE foldr1' #-}
foldr1' :: (a -> a -> a) -> Vector ty a -> a
foldr1' f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> a
G.foldr1' a -> a -> a
f) Vector ty a
v
ifoldl :: SVECTOR ty b => (a -> Int -> b -> a) -> a -> Vector ty b -> a
{-# INLINE ifoldl #-}
ifoldl :: (a -> Int -> b -> a) -> a -> Vector ty b -> a
ifoldl f :: a -> Int -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty b -> a) -> Vector ty b -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Int -> b -> a) -> a -> W t ty b -> a
forall (v :: * -> *) b a.
Vector v b =>
(a -> Int -> b -> a) -> a -> v b -> a
G.ifoldl a -> Int -> b -> a
f a
s) Vector ty b
v
ifoldl' :: SVECTOR ty b => (a -> Int -> b -> a) -> a -> Vector ty b -> a
{-# INLINE ifoldl' #-}
ifoldl' :: (a -> Int -> b -> a) -> a -> Vector ty b -> a
ifoldl' f :: a -> Int -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty b -> a) -> Vector ty b -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> Int -> b -> a) -> a -> W t ty b -> a
forall (v :: * -> *) b a.
Vector v b =>
(a -> Int -> b -> a) -> a -> v b -> a
G.ifoldl' a -> Int -> b -> a
f a
s) Vector ty b
v
ifoldr :: SVECTOR ty a => (Int -> a -> b -> b) -> b -> Vector ty a -> b
{-# INLINE ifoldr #-}
ifoldr :: (Int -> a -> b -> b) -> b -> Vector ty a -> b
ifoldr f :: Int -> a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall a b. (a -> b) -> a -> b
$ (W t ty a -> b) -> Vector ty a -> Proxy t -> b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((Int -> a -> b -> b) -> b -> W t ty a -> b
forall (v :: * -> *) a b.
Vector v a =>
(Int -> a -> b -> b) -> b -> v a -> b
G.ifoldr Int -> a -> b -> b
f b
s) Vector ty a
v
ifoldr' :: SVECTOR ty a => (Int -> a -> b -> b) -> b -> Vector ty a -> b
{-# INLINE ifoldr' #-}
ifoldr' :: (Int -> a -> b -> b) -> b -> Vector ty a -> b
ifoldr' f :: Int -> a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> b) -> b
forall a b. (a -> b) -> a -> b
$ (W t ty a -> b) -> Vector ty a -> Proxy t -> b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((Int -> a -> b -> b) -> b -> W t ty a -> b
forall (v :: * -> *) a b.
Vector v a =>
(Int -> a -> b -> b) -> b -> v a -> b
G.ifoldr' Int -> a -> b -> b
f b
s) Vector ty a
v
all :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> Bool
{-# INLINE all #-}
all :: (a -> Bool) -> Vector ty a -> Bool
all f :: a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> (a -> Bool) -> W t ty a -> Bool
forall (v :: * -> *) a. Vector v a => (a -> Bool) -> v a -> Bool
G.all a -> Bool
f (Proxy t -> Vector ty a -> W t ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector ty a
v)
any :: SVECTOR ty a => (a -> Bool) -> Vector ty a -> Bool
{-# INLINE any #-}
any :: (a -> Bool) -> Vector ty a -> Bool
any f :: a -> Bool
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Bool) -> Bool
forall a b. (a -> b) -> a -> b
$ \p :: Proxy t
p -> (a -> Bool) -> W t ty a -> Bool
forall (v :: * -> *) a. Vector v a => (a -> Bool) -> v a -> Bool
G.any a -> Bool
f (Proxy t -> Vector ty a -> W t ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy t
p Vector ty a
v)
sum :: (SVECTOR ty a, Num a) => Vector ty a -> a
{-# INLINE sum #-}
sum :: Vector ty a -> a
sum v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. (Vector v a, Num a) => v a -> a
G.sum Vector ty a
v
product :: (SVECTOR ty a, Num a) => Vector ty a -> a
{-# INLINE product #-}
product :: Vector ty a -> a
product v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. (Vector v a, Num a) => v a -> a
G.product Vector ty a
v
maximum :: (SVECTOR ty a, Ord a) => Vector ty a -> a
{-# INLINE maximum #-}
maximum :: Vector ty a -> a
maximum v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. (Vector v a, Ord a) => v a -> a
G.maximum Vector ty a
v
maximumBy :: SVECTOR ty a => (a -> a -> Ordering) -> Vector ty a -> a
{-# INLINE maximumBy #-}
maximumBy :: (a -> a -> Ordering) -> Vector ty a -> a
maximumBy f :: a -> a -> Ordering
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> Ordering) -> W t ty a -> a
forall (v :: * -> *) a.
Vector v a =>
(a -> a -> Ordering) -> v a -> a
G.maximumBy a -> a -> Ordering
f) Vector ty a
v
minimum :: (SVECTOR ty a, Ord a) => Vector ty a -> a
{-# INLINE minimum #-}
minimum :: Vector ty a -> a
minimum v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> a
forall (v :: * -> *) a. (Vector v a, Ord a) => v a -> a
G.minimum Vector ty a
v
minimumBy :: SVECTOR ty a => (a -> a -> Ordering) -> Vector ty a -> a
{-# INLINE minimumBy #-}
minimumBy :: (a -> a -> Ordering) -> Vector ty a -> a
minimumBy f :: a -> a -> Ordering
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> a) -> a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> a) -> Vector ty a -> Proxy t -> a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> Ordering) -> W t ty a -> a
forall (v :: * -> *) a.
Vector v a =>
(a -> a -> Ordering) -> v a -> a
G.minimumBy a -> a -> Ordering
f) Vector ty a
v
maxIndex :: (SVECTOR ty a, Ord a) => Vector ty a -> Int
{-# INLINE maxIndex #-}
maxIndex :: Vector ty a -> Int
maxIndex v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Int) -> Vector ty a -> Proxy t -> Int
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> Int
forall (v :: * -> *) a. (Vector v a, Ord a) => v a -> Int
G.maxIndex Vector ty a
v
maxIndexBy :: SVECTOR ty a => (a -> a -> Ordering) -> Vector ty a -> Int
{-# INLINE maxIndexBy #-}
maxIndexBy :: (a -> a -> Ordering) -> Vector ty a -> Int
maxIndexBy f :: a -> a -> Ordering
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Int) -> Vector ty a -> Proxy t -> Int
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> Ordering) -> W t ty a -> Int
forall (v :: * -> *) a.
Vector v a =>
(a -> a -> Ordering) -> v a -> Int
G.maxIndexBy a -> a -> Ordering
f) Vector ty a
v
minIndex :: (SVECTOR ty a, Ord a) => Vector ty a -> Int
{-# INLINE minIndex #-}
minIndex :: Vector ty a -> Int
minIndex v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Int) -> Vector ty a -> Proxy t -> Int
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> Int
forall (v :: * -> *) a. (Vector v a, Ord a) => v a -> Int
G.minIndex Vector ty a
v
minIndexBy :: SVECTOR ty a => (a -> a -> Ordering) -> Vector ty a -> Int
{-# INLINE minIndexBy #-}
minIndexBy :: (a -> a -> Ordering) -> Vector ty a -> Int
minIndexBy f :: a -> a -> Ordering
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Int) -> Int
forall a b. (a -> b) -> a -> b
$ (W t ty a -> Int) -> Vector ty a -> Proxy t -> Int
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> Ordering) -> W t ty a -> Int
forall (v :: * -> *) a.
Vector v a =>
(a -> a -> Ordering) -> v a -> Int
G.minIndexBy a -> a -> Ordering
f) Vector ty a
v
foldM :: (Monad m, SVECTOR ty b) => (a -> b -> m a) -> a -> Vector ty b -> m a
{-# INLINE foldM #-}
foldM :: (a -> b -> m a) -> a -> Vector ty b -> m a
foldM f :: a -> b -> m a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty b -> m a) -> Vector ty b -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> m a) -> a -> W t ty b -> m a
forall (m :: * -> *) (v :: * -> *) b a.
(Monad m, Vector v b) =>
(a -> b -> m a) -> a -> v b -> m a
G.foldM a -> b -> m a
f a
s) Vector ty b
v
fold1M :: (Monad m, SVECTOR ty a) => (a -> a -> m a) -> Vector ty a -> m a
{-# INLINE fold1M #-}
fold1M :: (a -> a -> m a) -> Vector ty a -> m a
fold1M f :: a -> a -> m a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m a) -> Vector ty a -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> m a) -> W t ty a -> m a
forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
(a -> a -> m a) -> v a -> m a
G.fold1M a -> a -> m a
f) Vector ty a
v
foldM' :: (Monad m, SVECTOR ty b) => (a -> b -> m a) -> a -> Vector ty b -> m a
{-# INLINE foldM' #-}
foldM' :: (a -> b -> m a) -> a -> Vector ty b -> m a
foldM' f :: a -> b -> m a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty b -> m a) -> Vector ty b -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> m a) -> a -> W t ty b -> m a
forall (m :: * -> *) (v :: * -> *) b a.
(Monad m, Vector v b) =>
(a -> b -> m a) -> a -> v b -> m a
G.foldM' a -> b -> m a
f a
s) Vector ty b
v
fold1M' :: (Monad m, SVECTOR ty a) => (a -> a -> m a) -> Vector ty a -> m a
{-# INLINE fold1M' #-}
fold1M' :: (a -> a -> m a) -> Vector ty a -> m a
fold1M' f :: a -> a -> m a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m a) -> m a
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m a) -> Vector ty a -> Proxy t -> m a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> m a) -> W t ty a -> m a
forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
(a -> a -> m a) -> v a -> m a
G.fold1M' a -> a -> m a
f) Vector ty a
v
foldM_ :: (Monad m, SVECTOR ty b) => (a -> b -> m a) -> a -> Vector ty b -> m ()
{-# INLINE foldM_ #-}
foldM_ :: (a -> b -> m a) -> a -> Vector ty b -> m ()
foldM_ f :: a -> b -> m a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ())
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ (W t ty b -> m ()) -> Vector ty b -> Proxy t -> m ()
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> m a) -> a -> W t ty b -> m ()
forall (m :: * -> *) (v :: * -> *) b a.
(Monad m, Vector v b) =>
(a -> b -> m a) -> a -> v b -> m ()
G.foldM_ a -> b -> m a
f a
s) Vector ty b
v
fold1M_ :: (Monad m, SVECTOR ty a) => (a -> a -> m a) -> Vector ty a -> m ()
{-# INLINE fold1M_ #-}
fold1M_ :: (a -> a -> m a) -> Vector ty a -> m ()
fold1M_ f :: a -> a -> m a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ())
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m ()) -> Vector ty a -> Proxy t -> m ()
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> m a) -> W t ty a -> m ()
forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
(a -> a -> m a) -> v a -> m ()
G.fold1M_ a -> a -> m a
f) Vector ty a
v
foldM'_ :: (Monad m, SVECTOR ty b) => (a -> b -> m a) -> a -> Vector ty b -> m ()
{-# INLINE foldM'_ #-}
foldM'_ :: (a -> b -> m a) -> a -> Vector ty b -> m ()
foldM'_ f :: a -> b -> m a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ())
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ (W t ty b -> m ()) -> Vector ty b -> Proxy t -> m ()
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> m a) -> a -> W t ty b -> m ()
forall (m :: * -> *) (v :: * -> *) b a.
(Monad m, Vector v b) =>
(a -> b -> m a) -> a -> v b -> m ()
G.foldM'_ a -> b -> m a
f a
s) Vector ty b
v
fold1M'_ :: (Monad m, SVECTOR ty a) => (a -> a -> m a) -> Vector ty a -> m ()
{-# INLINE fold1M'_ #-}
fold1M'_ :: (a -> a -> m a) -> Vector ty a -> m ()
fold1M'_ f :: a -> a -> m a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ())
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> m ()) -> m ()
forall a b. (a -> b) -> a -> b
$ (W t ty a -> m ()) -> Vector ty a -> Proxy t -> m ()
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> m a) -> W t ty a -> m ()
forall (m :: * -> *) (v :: * -> *) a.
(Monad m, Vector v a) =>
(a -> a -> m a) -> v a -> m ()
G.fold1M'_ a -> a -> m a
f) Vector ty a
v
prescanl :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> a) -> a -> Vector ty b -> Vector ty a
{-# INLINE prescanl #-}
prescanl :: (a -> b -> a) -> a -> Vector ty b -> Vector ty a
prescanl f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty b -> W t ty a) -> Vector ty b -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> W t ty a
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> a) -> a -> v b -> v a
G.prescanl a -> b -> a
f a
s) Vector ty b
v
prescanl' :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> a) -> a -> Vector ty b -> Vector ty a
{-# INLINE prescanl' #-}
prescanl' :: (a -> b -> a) -> a -> Vector ty b -> Vector ty a
prescanl' f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty b -> W t ty a) -> Vector ty b -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> W t ty a
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> a) -> a -> v b -> v a
G.prescanl' a -> b -> a
f a
s) Vector ty b
v
postscanl :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> a) -> a -> Vector ty b -> Vector ty a
{-# INLINE postscanl #-}
postscanl :: (a -> b -> a) -> a -> Vector ty b -> Vector ty a
postscanl f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty b -> W t ty a) -> Vector ty b -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> W t ty a
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> a) -> a -> v b -> v a
G.postscanl a -> b -> a
f a
s) Vector ty b
v
postscanl' :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> a) -> a -> Vector ty b -> Vector ty a
{-# INLINE postscanl' #-}
postscanl' :: (a -> b -> a) -> a -> Vector ty b -> Vector ty a
postscanl' f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty b -> W t ty a) -> Vector ty b -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> W t ty a
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> a) -> a -> v b -> v a
G.postscanl' a -> b -> a
f a
s) Vector ty b
v
scanl :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> a) -> a -> Vector ty b -> Vector ty a
{-# INLINE scanl #-}
scanl :: (a -> b -> a) -> a -> Vector ty b -> Vector ty a
scanl f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty b -> W t ty a) -> Vector ty b -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> W t ty a
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> a) -> a -> v b -> v a
G.scanl a -> b -> a
f a
s) Vector ty b
v
scanl' :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> a) -> a -> Vector ty b -> Vector ty a
{-# INLINE scanl' #-}
scanl' :: (a -> b -> a) -> a -> Vector ty b -> Vector ty a
scanl' f :: a -> b -> a
f s :: a
s v :: Vector ty b
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty b -> W t ty a) -> Vector ty b -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> a) -> a -> W t ty b -> W t ty a
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> a) -> a -> v b -> v a
G.scanl' a -> b -> a
f a
s) Vector ty b
v
scanl1 :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> Vector ty a
{-# INLINE scanl1 #-}
scanl1 :: (a -> a -> a) -> Vector ty a -> Vector ty a
scanl1 f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> v a
G.scanl1 a -> a -> a
f) Vector ty a
v
scanl1' :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> Vector ty a
{-# INLINE scanl1' #-}
scanl1' :: (a -> a -> a) -> Vector ty a -> Vector ty a
scanl1' f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> v a
G.scanl1' a -> a -> a
f) Vector ty a
v
prescanr :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> b) -> b -> Vector ty a -> Vector ty b
{-# INLINE prescanr #-}
prescanr :: (a -> b -> b) -> b -> Vector ty a -> Vector ty b
prescanr f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> b) -> b -> v a -> v b
G.prescanr a -> b -> b
f b
s) Vector ty a
v
prescanr' :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> b) -> b -> Vector ty a -> Vector ty b
{-# INLINE prescanr' #-}
prescanr' :: (a -> b -> b) -> b -> Vector ty a -> Vector ty b
prescanr' f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> b) -> b -> v a -> v b
G.prescanr' a -> b -> b
f b
s) Vector ty a
v
postscanr :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> b) -> b -> Vector ty a -> Vector ty b
{-# INLINE postscanr #-}
postscanr :: (a -> b -> b) -> b -> Vector ty a -> Vector ty b
postscanr f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> b) -> b -> v a -> v b
G.postscanr a -> b -> b
f b
s) Vector ty a
v
postscanr' :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> b) -> b -> Vector ty a -> Vector ty b
{-# INLINE postscanr' #-}
postscanr' :: (a -> b -> b) -> b -> Vector ty a -> Vector ty b
postscanr' f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> b) -> b -> v a -> v b
G.postscanr' a -> b -> b
f b
s) Vector ty a
v
scanr :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> b) -> b -> Vector ty a -> Vector ty b
{-# INLINE scanr #-}
scanr :: (a -> b -> b) -> b -> Vector ty a -> Vector ty b
scanr f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> b) -> b -> v a -> v b
G.scanr a -> b -> b
f b
s) Vector ty a
v
scanr' :: (SVECTOR ty a, SVECTOR ty b) => (a -> b -> b) -> b -> Vector ty a -> Vector ty b
{-# INLINE scanr' #-}
scanr' :: (a -> b -> b) -> b -> Vector ty a -> Vector ty b
scanr' f :: a -> b -> b
f s :: b
s v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty b)
-> Vector ty b
forall a b. (a -> b) -> a -> b
$ W t ty b -> Vector ty b
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty b -> Vector ty b)
-> (Proxy t -> W t ty b) -> Proxy t -> Vector ty b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty b) -> Vector ty a -> Proxy t -> W t ty b
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> b -> b) -> b -> W t ty a -> W t ty b
forall (v :: * -> *) a b.
(Vector v a, Vector v b) =>
(a -> b -> b) -> b -> v a -> v b
G.scanr' a -> b -> b
f b
s) Vector ty a
v
scanr1 :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> Vector ty a
{-# INLINE scanr1 #-}
scanr1 :: (a -> a -> a) -> Vector ty a -> Vector ty a
scanr1 f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> v a
G.scanr1 a -> a -> a
f) Vector ty a
v
scanr1' :: SVECTOR ty a => (a -> a -> a) -> Vector ty a -> Vector ty a
{-# INLINE scanr1' #-}
scanr1' :: (a -> a -> a) -> Vector ty a -> Vector ty a
scanr1' f :: a -> a -> a
f v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W t ty a -> Vector ty a)
-> (Proxy t -> W t ty a) -> Proxy t -> Vector ty a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (W t ty a -> W t ty a) -> Vector ty a -> Proxy t -> W t ty a
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW ((a -> a -> a) -> W t ty a -> W t ty a
forall (v :: * -> *) a. Vector v a => (a -> a -> a) -> v a -> v a
G.scanr1' a -> a -> a
f) Vector ty a
v
toList :: SVECTOR ty a => Vector ty a -> [a]
{-# INLINE toList #-}
toList :: Vector ty a -> [a]
toList v :: Vector ty a
v = (forall t. Reifies t (AcquireIO Any) => Proxy t -> [a]) -> [a]
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> [a]) -> [a])
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> [a]) -> [a]
forall a b. (a -> b) -> a -> b
$ (W t ty a -> [a]) -> Vector ty a -> Proxy t -> [a]
forall t (ty :: SEXPTYPE) a r (p :: * -> *).
(W t ty a -> r) -> Vector ty a -> p t -> r
proxyFW W t ty a -> [a]
forall (v :: * -> *) a. Vector v a => v a -> [a]
G.toList Vector ty a
v
fromList :: forall ty a . SVECTOR ty a => [a] -> Vector ty a
{-# INLINE fromList #-}
fromList :: [a] -> Vector ty a
fromList xs :: [a]
xs = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> [a] -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> [a] -> v a
G.fromListN ([a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length [a]
xs) [a]
xs)
fromListN :: forall ty a . SVECTOR ty a => Int -> [a] -> Vector ty a
{-# INLINE fromListN #-}
fromListN :: Int -> [a] -> Vector ty a
fromListN i :: Int
i l :: [a]
l = (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall s r.
(forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony ((forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a)
-> (forall t. Reifies t (AcquireIO Any) => Proxy t -> Vector ty a)
-> Vector ty a
forall a b. (a -> b) -> a -> b
$ W t ty a -> Proxy t -> Vector ty a
forall t (ty :: SEXPTYPE) a (p :: * -> *).
W t ty a -> p t -> Vector ty a
proxyW (Int -> [a] -> W t ty a
forall (v :: * -> *) a. Vector v a => Int -> [a] -> v a
G.fromListN Int
i [a]
l)
unsafeFreeze :: (VECTOR (Region m) ty a, MonadR m, ElemRep V ty ~ a)
=> MVector (Region m) ty a -> m (Vector ty a)
{-# INLINE unsafeFreeze #-}
unsafeFreeze :: MVector (Region m) ty a -> m (Vector ty a)
unsafeFreeze m :: MVector (Region m) ty a
m = (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (Vector ty a))
-> m (Vector ty a)
forall (m :: * -> *) r.
MonadR m =>
(forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m r)
-> m r
withAcquire ((forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (Vector ty a))
-> m (Vector ty a))
-> (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (Vector ty a))
-> m (Vector ty a)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy s
p -> W s ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W s ty a -> Vector ty a) -> m (W s ty a) -> m (Vector ty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Mutable (W s ty) (Region m) a -> m (W s ty a)
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
Mutable v (PrimState m) a -> m (v a)
G.unsafeFreeze (Proxy s -> MVector (Region m) ty a -> W s ty (Region m) a
forall (proxy :: * -> *) t s (ty :: SEXPTYPE) a.
proxy t -> MVector s ty a -> W t ty s a
Mutable.withW Proxy s
p MVector (Region m) ty a
m)
unsafeThaw :: (MonadR m, VECTOR (Region m) ty a, ElemRep V ty ~ a)
=> Vector ty a -> m (MVector (Region m) ty a)
{-# INLINE unsafeThaw #-}
unsafeThaw :: Vector ty a -> m (MVector (Region m) ty a)
unsafeThaw v :: Vector ty a
v = (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (MVector (Region m) ty a))
-> m (MVector (Region m) ty a)
forall (m :: * -> *) r.
MonadR m =>
(forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m r)
-> m r
withAcquire ((forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (MVector (Region m) ty a))
-> m (MVector (Region m) ty a))
-> (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (MVector (Region m) ty a))
-> m (MVector (Region m) ty a)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy s
p -> W s ty (Region m) a -> MVector (Region m) ty a
forall t (ty :: SEXPTYPE) s a. W t ty s a -> MVector s ty a
Mutable.unW (W s ty (Region m) a -> MVector (Region m) ty a)
-> m (W s ty (Region m) a) -> m (MVector (Region m) ty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> W s ty a -> m (Mutable (W s ty) (Region m) a)
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
v a -> m (Mutable v (PrimState m) a)
G.unsafeThaw (Proxy s -> Vector ty a -> W s ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy s
p Vector ty a
v)
thaw :: (MonadR m, VECTOR (Region m) ty a, ElemRep V ty ~ a)
=> Vector ty a -> m (MVector (Region m) ty a)
{-# INLINE thaw #-}
thaw :: Vector ty a -> m (MVector (Region m) ty a)
thaw v1 :: Vector ty a
v1 = (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (MVector (Region m) ty a))
-> m (MVector (Region m) ty a)
forall (m :: * -> *) r.
MonadR m =>
(forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m r)
-> m r
withAcquire ((forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (MVector (Region m) ty a))
-> m (MVector (Region m) ty a))
-> (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (MVector (Region m) ty a))
-> m (MVector (Region m) ty a)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy s
p -> W s ty (Region m) a -> MVector (Region m) ty a
forall t (ty :: SEXPTYPE) s a. W t ty s a -> MVector s ty a
Mutable.unW (W s ty (Region m) a -> MVector (Region m) ty a)
-> m (W s ty (Region m) a) -> m (MVector (Region m) ty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> W s ty a -> m (Mutable (W s ty) (Region m) a)
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
v a -> m (Mutable v (PrimState m) a)
G.thaw (Proxy s -> Vector ty a -> W s ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy s
p Vector ty a
v1)
freeze :: (MonadR m, VECTOR (Region m) ty a, ElemRep V ty ~ a)
=> MVector (Region m) ty a -> m (Vector ty a)
{-# INLINE freeze #-}
freeze :: MVector (Region m) ty a -> m (Vector ty a)
freeze m1 :: MVector (Region m) ty a
m1 = (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (Vector ty a))
-> m (Vector ty a)
forall (m :: * -> *) r.
MonadR m =>
(forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m r)
-> m r
withAcquire ((forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (Vector ty a))
-> m (Vector ty a))
-> (forall s.
Reifies s (AcquireIO (Region m)) =>
Proxy s -> m (Vector ty a))
-> m (Vector ty a)
forall a b. (a -> b) -> a -> b
$ \p :: Proxy s
p -> W s ty a -> Vector ty a
forall t (ty :: SEXPTYPE) a. W t ty a -> Vector ty a
unW (W s ty a -> Vector ty a) -> m (W s ty a) -> m (Vector ty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Mutable (W s ty) (Region m) a -> m (W s ty a)
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
Mutable v (PrimState m) a -> m (v a)
G.freeze (Proxy s -> MVector (Region m) ty a -> W s ty (Region m) a
forall (proxy :: * -> *) t s (ty :: SEXPTYPE) a.
proxy t -> MVector s ty a -> W t ty s a
Mutable.withW Proxy s
p MVector (Region m) ty a
m1)
unsafeCopy
:: (MonadR m, VECTOR (Region m) ty a, ElemRep V ty ~ a)
=> MVector (Region m) ty a -> Vector ty a -> m ()
{-# INLINE unsafeCopy #-}
unsafeCopy :: MVector (Region m) ty a -> Vector ty a -> m ()
unsafeCopy m1 :: MVector (Region m) ty a
m1 v2 :: Vector ty a
v2 = (forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m ())
-> m ()
forall (m :: * -> *) r.
MonadR m =>
(forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m r)
-> m r
withAcquire ((forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m ())
-> m ())
-> (forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m ())
-> m ()
forall a b. (a -> b) -> a -> b
$ \p :: Proxy s
p -> Mutable (W s ty) (Region m) a -> W s ty a -> m ()
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
Mutable v (PrimState m) a -> v a -> m ()
G.unsafeCopy (Proxy s -> MVector (Region m) ty a -> W s ty (Region m) a
forall (proxy :: * -> *) t s (ty :: SEXPTYPE) a.
proxy t -> MVector s ty a -> W t ty s a
Mutable.withW Proxy s
p MVector (Region m) ty a
m1) (Proxy s -> Vector ty a -> W s ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy s
p Vector ty a
v2)
copy :: (MonadR m, VECTOR (Region m) ty a, ElemRep V ty ~ a)
=> MVector (Region m) ty a -> Vector ty a -> m ()
{-# INLINE copy #-}
copy :: MVector (Region m) ty a -> Vector ty a -> m ()
copy m1 :: MVector (Region m) ty a
m1 v2 :: Vector ty a
v2 = (forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m ())
-> m ()
forall (m :: * -> *) r.
MonadR m =>
(forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m r)
-> m r
withAcquire ((forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m ())
-> m ())
-> (forall s. Reifies s (AcquireIO (Region m)) => Proxy s -> m ())
-> m ()
forall a b. (a -> b) -> a -> b
$ \p :: Proxy s
p -> Mutable (W s ty) (Region m) a -> W s ty a -> m ()
forall (m :: * -> *) (v :: * -> *) a.
(PrimMonad m, Vector v a) =>
Mutable v (PrimState m) a -> v a -> m ()
G.copy (Proxy s -> MVector (Region m) ty a -> W s ty (Region m) a
forall (proxy :: * -> *) t s (ty :: SEXPTYPE) a.
proxy t -> MVector s ty a -> W t ty s a
Mutable.withW Proxy s
p MVector (Region m) ty a
m1) (Proxy s -> Vector ty a -> W s ty a
forall (proxy :: * -> *) t (ty :: SEXPTYPE) a.
proxy t -> Vector ty a -> W t ty a
withW Proxy s
p Vector ty a
v2)
phony :: (forall t . Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony :: (forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
phony f :: forall t. Reifies t (AcquireIO s) => Proxy t -> r
f = AcquireIO s
-> (forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
forall a r. a -> (forall s. Reifies s a => Proxy s -> r) -> r
reify ((forall (ty :: SEXPTYPE). SEXP V ty -> IO (SEXP s ty))
-> AcquireIO s
forall s.
(forall (ty :: SEXPTYPE). SEXP V ty -> IO (SEXP s ty))
-> AcquireIO s
AcquireIO forall (ty :: SEXPTYPE). SEXP V ty -> IO (SEXP s ty)
forall (ty :: SEXPTYPE) g. SEXP V ty -> IO (SEXP g ty)
acquireIO) ((forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r)
-> (forall t. Reifies t (AcquireIO s) => Proxy t -> r) -> r
forall a b. (a -> b) -> a -> b
$ \p :: Proxy s
p -> Proxy s -> r
forall t. Reifies t (AcquireIO s) => Proxy t -> r
f Proxy s
p
where
acquireIO :: SEXP V ty -> IO (SEXP g ty)
acquireIO :: SEXP V ty -> IO (SEXP g ty)
acquireIO x :: SEXP V ty
x = IO (SEXP g ty) -> IO (SEXP g ty)
forall a. IO a -> IO a
mask_ (IO (SEXP g ty) -> IO (SEXP g ty))
-> IO (SEXP g ty) -> IO (SEXP g ty)
forall a b. (a -> b) -> a -> b
$ do
SEXP V ty -> IO ()
forall s (a :: SEXPTYPE). SEXP s a -> IO ()
R.preserveObject SEXP V ty
x
SEXP g ty -> IO (SEXP g ty)
forall (m :: * -> *) a. Monad m => a -> m a
return (SEXP g ty -> IO (SEXP g ty)) -> SEXP g ty -> IO (SEXP g ty)
forall a b. (a -> b) -> a -> b
$ SEXP V ty -> SEXP g ty
forall s (a :: SEXPTYPE) r. SEXP s a -> SEXP r a
R.unsafeRelease SEXP V ty
x