#ifndef MIN_VERSION_base
#define MIN_VERSION_base(x,y,z) 1
#endif
module Data.Vector.Hybrid.Mutable
( MVector
, IOVector
, STVector
, length, null
, slice, init, tail, take, drop
, unsafeSlice, unsafeInit, unsafeTail, unsafeTake, unsafeDrop
, overlaps
, new, unsafeNew, replicate, clone
, grow, unsafeGrow
, clear
, read, write, swap
, unsafeRead, unsafeWrite, unsafeSwap
, set, copy, unsafeCopy
, unsafeZip, projectFst, projectSnd
, newWith, unsafeNewWith
) where
import Control.Monad.Primitive
import qualified Data.Vector.Generic.Mutable as G
import Data.Vector.Hybrid.Internal
import Prelude hiding ( length, null, replicate, reverse, map, read, take, drop, init, tail )
type IOVector u v = MVector u v RealWorld
type STVector = MVector
length :: G.MVector u a => MVector u v s (a, b) -> Int
length (MV ks _) = G.length ks
null :: G.MVector u a => MVector u v s (a, b) -> Bool
null (MV ks _) = G.null ks
slice :: (G.MVector u a, G.MVector v b) => Int -> Int -> MVector u v s (a, b) -> MVector u v s (a, b)
slice = G.slice
take :: (G.MVector u a, G.MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
take = G.take
drop :: (G.MVector u a, G.MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
drop = G.drop
init :: (G.MVector u a, G.MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
init = G.init
tail :: (G.MVector u a, G.MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
tail = G.tail
unsafeSlice :: (G.MVector u a, G.MVector v b)
=> Int
-> Int
-> MVector u v s (a, b)
-> MVector u v s (a, b)
unsafeSlice = G.unsafeSlice
unsafeTake :: (G.MVector u a, G.MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
unsafeTake = G.unsafeTake
unsafeDrop :: (G.MVector u a, G.MVector v b) => Int -> MVector u v s (a, b) -> MVector u v s (a, b)
unsafeDrop = G.unsafeDrop
unsafeInit :: (G.MVector u a, G.MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
unsafeInit = G.unsafeInit
unsafeTail :: (G.MVector u a, G.MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b)
unsafeTail = G.unsafeTail
overlaps :: (G.MVector u a, G.MVector v b) => MVector u v s (a, b) -> MVector u v s (a, b) -> Bool
overlaps = G.overlaps
new :: (PrimMonad m, G.MVector u a, G.MVector v b) => Int -> m (MVector u v (PrimState m) (a, b))
new = G.new
unsafeNew :: (PrimMonad m, G.MVector u a, G.MVector v b) => Int -> m (MVector u v (PrimState m) (a, b))
unsafeNew = G.unsafeNew
replicate :: (PrimMonad m, G.MVector u a, G.MVector v b) => Int -> (a, b) -> m (MVector u v (PrimState m) (a, b))
replicate = G.replicate
clone :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> m (MVector u v (PrimState m) (a, b))
clone = G.clone
grow :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> m (MVector u v (PrimState m) (a, b))
grow = G.grow
unsafeGrow :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> m (MVector u v (PrimState m) (a, b))
unsafeGrow = G.unsafeGrow
clear :: (PrimMonad m, G.MVector u a, G.MVector v b) => MVector u v (PrimState m) (a, b) -> m ()
clear = G.clear
read :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> m (a, b)
read = G.read
write :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> (a, b) -> m ()
write = G.write
swap :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> Int -> m ()
swap = G.swap
unsafeRead :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> m (a, b)
unsafeRead = G.unsafeRead
unsafeWrite :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> (a, b) -> m ()
unsafeWrite = G.unsafeWrite
unsafeSwap
:: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> Int -> Int -> m ()
unsafeSwap = G.unsafeSwap
set :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> (a, b) -> m ()
set = G.set
copy :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b) -> MVector u v (PrimState m) (a, b) -> m ()
copy = G.copy
unsafeCopy :: (PrimMonad m, G.MVector u a, G.MVector v b)
=> MVector u v (PrimState m) (a, b)
-> MVector u v (PrimState m) (a, b)
-> m ()
unsafeCopy = G.unsafeCopy
unsafeZip :: u s a -> v s b -> MVector u v s (a, b)
unsafeZip = MV
projectFst :: MVector u v s (a, b) -> u s a
projectFst (MV ks _) = ks
projectSnd :: MVector u v s (a, b) -> v s b
projectSnd (MV _ vs) = vs
newWith :: (PrimMonad m, G.MVector u a, G.MVector v b) => Int -> (a, b) -> m (MVector u v (PrimState m) (a, b))
newWith = G.replicate
unsafeNewWith :: (PrimMonad m, G.MVector u a, G.MVector v b) => Int -> (a, b) -> m (MVector u v (PrimState m) (a, b))
unsafeNewWith = G.replicate