vector-endian-0.1.0.0: Storable vectors with cpu-independent representation.

Safe HaskellNone
LanguageHaskell2010

Data.Vector.Endian

Contents

Synopsis

Documentation

data MVector s a Source #

Instances
(Storable a, Endian a) => MVector MVector a Source # 
Instance details

Defined in Internal.Vector

Methods

basicLength :: MVector s a -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s a -> MVector s a #

basicOverlaps :: MVector s a -> MVector s a -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) a) #

basicInitialize :: PrimMonad m => MVector (PrimState m) a -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> a -> m (MVector (PrimState m) a) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) a -> Int -> m a #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) a -> Int -> a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) a -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) a -> a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) a -> MVector (PrimState m) a -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) a -> Int -> m (MVector (PrimState m) a) #

NFData (MVector s a) Source # 
Instance details

Defined in Internal.Vector

Methods

rnf :: MVector s a -> () #

data Vector a Source #

Instances
(Storable a, Endian a) => Vector Vector a Source # 
Instance details

Defined in Internal.Vector

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) a -> m (Vector a) #

basicUnsafeThaw :: PrimMonad m => Vector a -> m (Mutable Vector (PrimState m) a) #

basicLength :: Vector a -> Int #

basicUnsafeSlice :: Int -> Int -> Vector a -> Vector a #

basicUnsafeIndexM :: Monad m => Vector a -> Int -> m a #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) a -> Vector a -> m () #

elemseq :: Vector a -> a -> b -> b #

(Storable a, Endian a) => IsList (Vector a) Source # 
Instance details

Defined in Internal.Vector

Associated Types

type Item (Vector a) :: Type #

Methods

fromList :: [Item (Vector a)] -> Vector a #

fromListN :: Int -> [Item (Vector a)] -> Vector a #

toList :: Vector a -> [Item (Vector a)] #

(Storable a, Eq a) => Eq (Vector a) Source # 
Instance details

Defined in Internal.Vector

Methods

(==) :: Vector a -> Vector a -> Bool #

(/=) :: Vector a -> Vector a -> Bool #

(Read a, Storable a, Endian a) => Read (Vector a) Source # 
Instance details

Defined in Internal.Vector

(Show a, Storable a, Endian a) => Show (Vector a) Source # 
Instance details

Defined in Internal.Vector

Methods

showsPrec :: Int -> Vector a -> ShowS #

show :: Vector a -> String #

showList :: [Vector a] -> ShowS #

Storable a => Semigroup (Vector a) Source # 
Instance details

Defined in Internal.Vector

Methods

(<>) :: Vector a -> Vector a -> Vector a #

sconcat :: NonEmpty (Vector a) -> Vector a #

stimes :: Integral b => b -> Vector a -> Vector a #

Storable a => Monoid (Vector a) Source # 
Instance details

Defined in Internal.Vector

Methods

mempty :: Vector a #

mappend :: Vector a -> Vector a -> Vector a #

mconcat :: [Vector a] -> Vector a #

NFData (Vector a) Source # 
Instance details

Defined in Internal.Vector

Methods

rnf :: Vector a -> () #

type Mutable Vector Source # 
Instance details

Defined in Internal.Vector

type Item (Vector a) Source # 
Instance details

Defined in Internal.Vector

type Item (Vector a) = a

Accessors

Length information

length :: (Storable a, Endian a) => Vector a -> Int Source #

null :: (Storable a, Endian a) => Vector a -> Bool Source #

Indexing

(!) :: (Storable a, Endian a) => Vector a -> Int -> a Source #

(!?) :: (Storable a, Endian a) => Vector a -> Int -> Maybe a Source #

head :: (Storable a, Endian a) => Vector a -> a Source #

last :: (Storable a, Endian a) => Vector a -> a Source #

unsafeIndex :: (Storable a, Endian a) => Vector a -> Int -> a Source #

unsafeHead :: (Storable a, Endian a) => Vector a -> a Source #

unsafeLast :: (Storable a, Endian a) => Vector a -> a Source #

Monadic indexing

indexM :: (Storable a, Endian a, Monad m) => Vector a -> Int -> m a Source #

headM :: (Storable a, Endian a, Monad m) => Vector a -> m a Source #

lastM :: (Storable a, Endian a, Monad m) => Vector a -> m a Source #

unsafeIndexM :: (Storable a, Endian a, Monad m) => Vector a -> Int -> m a Source #

unsafeHeadM :: (Storable a, Endian a, Monad m) => Vector a -> m a Source #

unsafeLastM :: (Storable a, Endian a, Monad m) => Vector a -> m a Source #

Extracting subvectors (slicing)

slice :: (Storable a, Endian a) => Int -> Int -> Vector a -> Vector a Source #

init :: (Storable a, Endian a) => Vector a -> Vector a Source #

tail :: (Storable a, Endian a) => Vector a -> Vector a Source #

take :: (Storable a, Endian a) => Int -> Vector a -> Vector a Source #

drop :: (Storable a, Endian a) => Int -> Vector a -> Vector a Source #

splitAt :: (Storable a, Endian a) => Int -> Vector a -> (Vector a, Vector a) Source #

unsafeSlice :: (Storable a, Endian a) => Int -> Int -> Vector a -> Vector a Source #

unsafeInit :: (Storable a, Endian a) => Vector a -> Vector a Source #

unsafeTail :: (Storable a, Endian a) => Vector a -> Vector a Source #

unsafeTake :: (Storable a, Endian a) => Int -> Vector a -> Vector a Source #

unsafeDrop :: (Storable a, Endian a) => Int -> Vector a -> Vector a Source #

Construction

Initialisation

empty :: (Storable a, Endian a) => Vector a Source #

singleton :: (Storable a, Endian a) => a -> Vector a Source #

replicate :: (Storable a, Endian a) => Int -> a -> Vector a Source #

generate :: (Storable a, Endian a) => Int -> (Int -> a) -> Vector a Source #

iterateN :: (Storable a, Endian a) => Int -> (a -> a) -> a -> Vector a Source #

Monadic initialisation

replicateM :: (Monad m, Storable a, Endian a) => Int -> m a -> m (Vector a) Source #

generateM :: (Monad m, Storable a, Endian a) => Int -> (Int -> m a) -> m (Vector a) Source #

iterateNM :: (Monad m, Storable a, Endian a) => Int -> (a -> m a) -> a -> m (Vector a) Source #

create :: (Storable a, Endian a) => (forall s. ST s (MVector s a)) -> Vector a Source #

createT :: (Traversable f, Storable a, Endian a) => (forall s. ST s (f (MVector s a))) -> f (Vector a) Source #

Unfolding

unfoldr :: (Storable a, Endian a) => (b -> Maybe (a, b)) -> b -> Vector a Source #

unfoldrN :: (Storable a, Endian a) => Int -> (b -> Maybe (a, b)) -> b -> Vector a Source #

unfoldrM :: (Monad m, Storable a, Endian a) => (b -> m (Maybe (a, b))) -> b -> m (Vector a) Source #

unfoldrNM :: (Monad m, Storable a, Endian a) => Int -> (b -> m (Maybe (a, b))) -> b -> m (Vector a) Source #

constructN :: (Storable a, Endian a) => Int -> (Vector a -> a) -> Vector a Source #

constructrN :: (Storable a, Endian a) => Int -> (Vector a -> a) -> Vector a Source #

Enumeration

enumFromN :: (Storable a, Endian a, Num a) => a -> Int -> Vector a Source #

enumFromStepN :: (Storable a, Endian a, Num a) => a -> a -> Int -> Vector a Source #

enumFromTo :: (Storable a, Endian a, Enum a) => a -> a -> Vector a Source #

enumFromThenTo :: (Storable a, Endian a, Enum a) => a -> a -> a -> Vector a Source #

Raw pointers

unsafeFromForeignPtr :: (Storable a, Endian a) => ForeignPtr a -> Int -> Int -> Vector a Source #

unsafeToForeignPtr :: (Storable a, Endian a) => Vector a -> (ForeignPtr a, Int, Int) Source #

unsafeToForeignPtr0 :: (Storable a, Endian a) => Vector a -> (ForeignPtr a, Int) Source #

unsafeWith :: (Storable a, Endian a) => Vector a -> (Ptr a -> IO b) -> IO b Source #

Like unsafeWith, but note well: the pointer will point to the value in its *wire format*, which may not match the host cpu endianness.