unboxing-vector-0.2.0.0: A newtype-friendly variant of unboxed vectors

Safe HaskellNone
LanguageHaskell2010

Data.Vector.Unboxing

Contents

Synopsis

Documentation

data Vector a Source #

Instances
Unboxable a => Vector Vector a Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

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 #

Unboxable a => IsList (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

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)] #

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

Defined in Data.Vector.Unboxing.Internal

Methods

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

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

(Ord a, Unboxable a) => Ord (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Methods

compare :: Vector a -> Vector a -> Ordering #

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

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

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

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

max :: Vector a -> Vector a -> Vector a #

min :: Vector a -> Vector a -> Vector a #

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

Defined in Data.Vector.Unboxing.Internal

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

Defined in Data.Vector.Unboxing.Internal

Methods

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

show :: Vector a -> String #

showList :: [Vector a] -> ShowS #

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

Defined in Data.Vector.Unboxing.Internal

Methods

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

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

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

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

Defined in Data.Vector.Unboxing.Internal

Methods

mempty :: Vector a #

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

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

NFData (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Methods

rnf :: Vector a -> () #

Unboxable a => SemiSequence (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

Associated Types

type Index (Vector a) :: Type #

Methods

intersperse :: Element (Vector a) -> Vector a -> Vector a #

reverse :: Vector a -> Vector a #

find :: (Element (Vector a) -> Bool) -> Vector a -> Maybe (Element (Vector a)) #

sortBy :: (Element (Vector a) -> Element (Vector a) -> Ordering) -> Vector a -> Vector a #

cons :: Element (Vector a) -> Vector a -> Vector a #

snoc :: Vector a -> Element (Vector a) -> Vector a #

Unboxable a => IsSequence (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

Methods

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

lengthIndex :: Vector a -> Index (Vector a) #

break :: (Element (Vector a) -> Bool) -> Vector a -> (Vector a, Vector a) #

span :: (Element (Vector a) -> Bool) -> Vector a -> (Vector a, Vector a) #

dropWhile :: (Element (Vector a) -> Bool) -> Vector a -> Vector a #

takeWhile :: (Element (Vector a) -> Bool) -> Vector a -> Vector a #

splitAt :: Index (Vector a) -> Vector a -> (Vector a, Vector a) #

unsafeSplitAt :: Index (Vector a) -> Vector a -> (Vector a, Vector a) #

take :: Index (Vector a) -> Vector a -> Vector a #

unsafeTake :: Index (Vector a) -> Vector a -> Vector a #

drop :: Index (Vector a) -> Vector a -> Vector a #

unsafeDrop :: Index (Vector a) -> Vector a -> Vector a #

dropEnd :: Index (Vector a) -> Vector a -> Vector a #

partition :: (Element (Vector a) -> Bool) -> Vector a -> (Vector a, Vector a) #

uncons :: Vector a -> Maybe (Element (Vector a), Vector a) #

unsnoc :: Vector a -> Maybe (Vector a, Element (Vector a)) #

filter :: (Element (Vector a) -> Bool) -> Vector a -> Vector a #

filterM :: Monad m => (Element (Vector a) -> m Bool) -> Vector a -> m (Vector a) #

replicate :: Index (Vector a) -> Element (Vector a) -> Vector a #

replicateM :: Monad m => Index (Vector a) -> m (Element (Vector a)) -> m (Vector a) #

groupBy :: (Element (Vector a) -> Element (Vector a) -> Bool) -> Vector a -> [Vector a] #

groupAllOn :: Eq b => (Element (Vector a) -> b) -> Vector a -> [Vector a] #

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

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

tailEx :: Vector a -> Vector a #

tailMay :: Vector a -> Maybe (Vector a) #

initEx :: Vector a -> Vector a #

initMay :: Vector a -> Maybe (Vector a) #

unsafeTail :: Vector a -> Vector a #

unsafeInit :: Vector a -> Vector a #

index :: Vector a -> Index (Vector a) -> Maybe (Element (Vector a)) #

indexEx :: Vector a -> Index (Vector a) -> Element (Vector a) #

unsafeIndex :: Vector a -> Index (Vector a) -> Element (Vector a) #

splitWhen :: (Element (Vector a) -> Bool) -> Vector a -> [Vector a] #

Unboxable a => MonoFunctor (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

Methods

omap :: (Element (Vector a) -> Element (Vector a)) -> Vector a -> Vector a #

Unboxable a => MonoFoldable (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

Methods

ofoldMap :: Monoid m => (Element (Vector a) -> m) -> Vector a -> m #

ofoldr :: (Element (Vector a) -> b -> b) -> b -> Vector a -> b #

ofoldl' :: (a0 -> Element (Vector a) -> a0) -> a0 -> Vector a -> a0 #

otoList :: Vector a -> [Element (Vector a)] #

oall :: (Element (Vector a) -> Bool) -> Vector a -> Bool #

oany :: (Element (Vector a) -> Bool) -> Vector a -> Bool #

onull :: Vector a -> Bool #

olength :: Vector a -> Int #

olength64 :: Vector a -> Int64 #

ocompareLength :: Integral i => Vector a -> i -> Ordering #

otraverse_ :: Applicative f => (Element (Vector a) -> f b) -> Vector a -> f () #

ofor_ :: Applicative f => Vector a -> (Element (Vector a) -> f b) -> f () #

omapM_ :: Applicative m => (Element (Vector a) -> m ()) -> Vector a -> m () #

oforM_ :: Applicative m => Vector a -> (Element (Vector a) -> m ()) -> m () #

ofoldlM :: Monad m => (a0 -> Element (Vector a) -> m a0) -> a0 -> Vector a -> m a0 #

ofoldMap1Ex :: Semigroup m => (Element (Vector a) -> m) -> Vector a -> m #

ofoldr1Ex :: (Element (Vector a) -> Element (Vector a) -> Element (Vector a)) -> Vector a -> Element (Vector a) #

ofoldl1Ex' :: (Element (Vector a) -> Element (Vector a) -> Element (Vector a)) -> Vector a -> Element (Vector a) #

headEx :: Vector a -> Element (Vector a) #

lastEx :: Vector a -> Element (Vector a) #

unsafeHead :: Vector a -> Element (Vector a) #

unsafeLast :: Vector a -> Element (Vector a) #

maximumByEx :: (Element (Vector a) -> Element (Vector a) -> Ordering) -> Vector a -> Element (Vector a) #

minimumByEx :: (Element (Vector a) -> Element (Vector a) -> Ordering) -> Vector a -> Element (Vector a) #

oelem :: Element (Vector a) -> Vector a -> Bool #

onotElem :: Element (Vector a) -> Vector a -> Bool #

Unboxable a => MonoTraversable (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

Methods

otraverse :: Applicative f => (Element (Vector a) -> f (Element (Vector a))) -> Vector a -> f (Vector a) #

omapM :: Applicative m => (Element (Vector a) -> m (Element (Vector a))) -> Vector a -> m (Vector a) #

Unboxable a => MonoPointed (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

Methods

opoint :: Element (Vector a) -> Vector a #

Unboxable a => GrowingAppend (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

type Mutable Vector Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

type Item (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

type Item (Vector a) = a
type Index (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

type Index (Vector a) = Int
type Element (Vector a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Instances

type Element (Vector a) = a

class Unbox (Rep a) => Unboxable a Source #

Types that can be stored in unboxed vectors (Vector and MVector).

You can define instances of this class like:

newtype Foo = Foo Int
instance Unboxable Foo where
  type Rep Foo = Int

The type specified by Rep needs to be an instance of Unbox, and coercion must be possible between the two types.

Instances can also be derived with GeneralizedNewtypeDeriving. GND always works if the base type is an instance of Unboxable.

If you want to have non-trivial correspondence between the type and the representation, use Generics wrapper with DerivingVia.

Note that UndecidableInstances is needed if you use GND or DerivingVia to derive instances.

Associated Types

type Rep a Source #

The underlying type of a. Must be an instance of Unbox.

Instances
Unboxable Bool Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Bool :: Type Source #

type CoercibleRep Bool :: Type

type IsTrivial Bool :: Bool

Unboxable Char Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Char :: Type Source #

type CoercibleRep Char :: Type

type IsTrivial Char :: Bool

Unboxable Double Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Double :: Type Source #

type CoercibleRep Double :: Type

type IsTrivial Double :: Bool

Unboxable Float Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Float :: Type Source #

type CoercibleRep Float :: Type

type IsTrivial Float :: Bool

Unboxable Int Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Int :: Type Source #

type CoercibleRep Int :: Type

type IsTrivial Int :: Bool

Unboxable Int8 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Int8 :: Type Source #

type CoercibleRep Int8 :: Type

type IsTrivial Int8 :: Bool

Unboxable Int16 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Int16 :: Type Source #

type CoercibleRep Int16 :: Type

type IsTrivial Int16 :: Bool

Unboxable Int32 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Int32 :: Type Source #

type CoercibleRep Int32 :: Type

type IsTrivial Int32 :: Bool

Unboxable Int64 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Int64 :: Type Source #

type CoercibleRep Int64 :: Type

type IsTrivial Int64 :: Bool

Unboxable Ordering Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Ordering :: Type Source #

type CoercibleRep Ordering :: Type

type IsTrivial Ordering :: Bool

Unboxable Word Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Word :: Type Source #

type CoercibleRep Word :: Type

type IsTrivial Word :: Bool

Unboxable Word8 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Word8 :: Type Source #

type CoercibleRep Word8 :: Type

type IsTrivial Word8 :: Bool

Unboxable Word16 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Word16 :: Type Source #

type CoercibleRep Word16 :: Type

type IsTrivial Word16 :: Bool

Unboxable Word32 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Word32 :: Type Source #

type CoercibleRep Word32 :: Type

type IsTrivial Word32 :: Bool

Unboxable Word64 Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Word64 :: Type Source #

type CoercibleRep Word64 :: Type

type IsTrivial Word64 :: Bool

Unboxable () Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep () :: Type Source #

type CoercibleRep () :: Type

type IsTrivial () :: Bool

Methods

unboxingFrom :: () -> Rep ()

unboxingTo :: Rep () -> ()

Unboxable All Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep All :: Type Source #

type CoercibleRep All :: Type

type IsTrivial All :: Bool

Unboxable Any Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep Any :: Type Source #

type CoercibleRep Any :: Type

type IsTrivial Any :: Bool

Unboxable a => Unboxable (Complex a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Complex a) :: Type Source #

type CoercibleRep (Complex a) :: Type

type IsTrivial (Complex a) :: Bool

Unboxable a => Unboxable (Min a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Min a) :: Type Source #

type CoercibleRep (Min a) :: Type

type IsTrivial (Min a) :: Bool

Methods

unboxingFrom :: Min a -> Rep (Min a)

unboxingTo :: Rep (Min a) -> Min a

Unboxable a => Unboxable (Max a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Max a) :: Type Source #

type CoercibleRep (Max a) :: Type

type IsTrivial (Max a) :: Bool

Methods

unboxingFrom :: Max a -> Rep (Max a)

unboxingTo :: Rep (Max a) -> Max a

Unboxable a => Unboxable (First a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (First a) :: Type Source #

type CoercibleRep (First a) :: Type

type IsTrivial (First a) :: Bool

Methods

unboxingFrom :: First a -> Rep (First a)

unboxingTo :: Rep (First a) -> First a

Unboxable a => Unboxable (Last a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Last a) :: Type Source #

type CoercibleRep (Last a) :: Type

type IsTrivial (Last a) :: Bool

Methods

unboxingFrom :: Last a -> Rep (Last a)

unboxingTo :: Rep (Last a) -> Last a

Unboxable a => Unboxable (WrappedMonoid a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (WrappedMonoid a) :: Type Source #

type CoercibleRep (WrappedMonoid a) :: Type

type IsTrivial (WrappedMonoid a) :: Bool

Unboxable a => Unboxable (Identity a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Identity a) :: Type Source #

type CoercibleRep (Identity a) :: Type

type IsTrivial (Identity a) :: Bool

Unboxable a => Unboxable (Dual a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Dual a) :: Type Source #

type CoercibleRep (Dual a) :: Type

type IsTrivial (Dual a) :: Bool

Methods

unboxingFrom :: Dual a -> Rep (Dual a)

unboxingTo :: Rep (Dual a) -> Dual a

Unboxable a => Unboxable (Sum a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Sum a) :: Type Source #

type CoercibleRep (Sum a) :: Type

type IsTrivial (Sum a) :: Bool

Methods

unboxingFrom :: Sum a -> Rep (Sum a)

unboxingTo :: Rep (Sum a) -> Sum a

Unboxable a => Unboxable (Product a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Product a) :: Type Source #

type CoercibleRep (Product a) :: Type

type IsTrivial (Product a) :: Bool

Unboxable a => Unboxable (Down a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Down a) :: Type Source #

type CoercibleRep (Down a) :: Type

type IsTrivial (Down a) :: Bool

Methods

unboxingFrom :: Down a -> Rep (Down a)

unboxingTo :: Rep (Down a) -> Down a

Enum a => Unboxable (Enum a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Enum a) :: Type Source #

type CoercibleRep (Enum a) :: Type

type IsTrivial (Enum a) :: Bool

Methods

unboxingFrom :: Enum a -> Rep (Enum a)

unboxingTo :: Rep (Enum a) -> Enum a

(Generic a, Unbox (Rep' (Rep a)), Unboxable' (Rep a)) => Unboxable (Generics a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Generics a) :: Type Source #

type CoercibleRep (Generics a) :: Type

type IsTrivial (Generics a) :: Bool

(Unboxable a, Unboxable b) => Unboxable (a, b) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (a, b) :: Type Source #

type CoercibleRep (a, b) :: Type

type IsTrivial (a, b) :: Bool

Methods

unboxingFrom :: (a, b) -> Rep (a, b)

unboxingTo :: Rep (a, b) -> (a, b)

(Unboxable a, Unboxable b) => Unboxable (Arg a b) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Arg a b) :: Type Source #

type CoercibleRep (Arg a b) :: Type

type IsTrivial (Arg a b) :: Bool

Methods

unboxingFrom :: Arg a b -> Rep (Arg a b)

unboxingTo :: Rep (Arg a b) -> Arg a b

(Enum a, Integral rep, Unbox rep) => Unboxable (EnumRep rep a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (EnumRep rep a) :: Type Source #

type CoercibleRep (EnumRep rep a) :: Type

type IsTrivial (EnumRep rep a) :: Bool

Methods

unboxingFrom :: EnumRep rep a -> Rep (EnumRep rep a)

unboxingTo :: Rep (EnumRep rep a) -> EnumRep rep a

(Unboxable a, Unboxable b, Unboxable c) => Unboxable (a, b, c) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (a, b, c) :: Type Source #

type CoercibleRep (a, b, c) :: Type

type IsTrivial (a, b, c) :: Bool

Methods

unboxingFrom :: (a, b, c) -> Rep (a, b, c)

unboxingTo :: Rep (a, b, c) -> (a, b, c)

Unboxable a => Unboxable (Const a b) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Const a b) :: Type Source #

type CoercibleRep (Const a b) :: Type

type IsTrivial (Const a b) :: Bool

Methods

unboxingFrom :: Const a b -> Rep (Const a b)

unboxingTo :: Rep (Const a b) -> Const a b

Unboxable (f a) => Unboxable (Alt f a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Alt f a) :: Type Source #

type CoercibleRep (Alt f a) :: Type

type IsTrivial (Alt f a) :: Bool

Methods

unboxingFrom :: Alt f a -> Rep (Alt f a)

unboxingTo :: Rep (Alt f a) -> Alt f a

(Unboxable a, Unboxable b, Unboxable c, Unboxable d) => Unboxable (a, b, c, d) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (a, b, c, d) :: Type Source #

type CoercibleRep (a, b, c, d) :: Type

type IsTrivial (a, b, c, d) :: Bool

Methods

unboxingFrom :: (a, b, c, d) -> Rep (a, b, c, d)

unboxingTo :: Rep (a, b, c, d) -> (a, b, c, d)

(Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e) => Unboxable (a, b, c, d, e) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (a, b, c, d, e) :: Type Source #

type CoercibleRep (a, b, c, d, e) :: Type

type IsTrivial (a, b, c, d, e) :: Bool

Methods

unboxingFrom :: (a, b, c, d, e) -> Rep (a, b, c, d, e)

unboxingTo :: Rep (a, b, c, d, e) -> (a, b, c, d, e)

Unboxable (f (g a)) => Unboxable (Compose f g a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Compose f g a) :: Type Source #

type CoercibleRep (Compose f g a) :: Type

type IsTrivial (Compose f g a) :: Bool

Methods

unboxingFrom :: Compose f g a -> Rep (Compose f g a)

unboxingTo :: Rep (Compose f g a) -> Compose f g a

(Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e, Unboxable f) => Unboxable (a, b, c, d, e, f) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (a, b, c, d, e, f) :: Type Source #

type CoercibleRep (a, b, c, d, e, f) :: Type

type IsTrivial (a, b, c, d, e, f) :: Bool

Methods

unboxingFrom :: (a, b, c, d, e, f) -> Rep (a, b, c, d, e, f)

unboxingTo :: Rep (a, b, c, d, e, f) -> (a, b, c, d, e, f)

newtype Generics a Source #

A newtype wrapper to be used with DerivingVia.

Usage:

data Bar = Bar !Int !Int
  deriving Generic
  deriving Unboxable via Generics Bar

Constructors

Generics a 
Instances
(Generic a, Unbox (Rep' (Rep a)), Unboxable' (Rep a)) => Unboxable (Generics a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Generics a) :: Type Source #

type CoercibleRep (Generics a) :: Type

type IsTrivial (Generics a) :: Bool

type Rep (Generics a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

type Rep (Generics a)

newtype Enum a Source #

A newtype wrapper to be used with DerivingVia. The value will be stored as Int, via fromEnum/toEnum.

Usage:

data Direction = North | South | East | West
  deriving Enum
  deriving Data.Vector.Unboxing.Unboxable via Data.Vector.Unboxing.Enum Bar

Constructors

Enum a 
Instances
Enum a => Unboxable (Enum a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (Enum a) :: Type Source #

type CoercibleRep (Enum a) :: Type

type IsTrivial (Enum a) :: Bool

Methods

unboxingFrom :: Enum a -> Rep (Enum a)

unboxingTo :: Rep (Enum a) -> Enum a

type Rep (Enum a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

type Rep (Enum a) = Int

newtype EnumRep rep a Source #

A newtype wrapper to be used with DerivingVia.

Usage:

data Direction = North | South | East | West
  deriving Enum
  deriving Data.Vector.Unboxing.Unboxable via Data.Vector.Unboxing.EnumRep Int8 Bar

Constructors

EnumRep a 
Instances
(Enum a, Integral rep, Unbox rep) => Unboxable (EnumRep rep a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

Associated Types

type Rep (EnumRep rep a) :: Type Source #

type CoercibleRep (EnumRep rep a) :: Type

type IsTrivial (EnumRep rep a) :: Bool

Methods

unboxingFrom :: EnumRep rep a -> Rep (EnumRep rep a)

unboxingTo :: Rep (EnumRep rep a) -> EnumRep rep a

type Rep (EnumRep rep a) Source # 
Instance details

Defined in Data.Vector.Unboxing.Internal

type Rep (EnumRep rep a) = rep

Accessors

Length information

Indexing

(!) :: Unboxable a => Vector a -> Int -> a Source #

(!?) :: Unboxable a => Vector a -> Int -> Maybe a Source #

head :: Unboxable a => Vector a -> a Source #

last :: Unboxable a => Vector a -> a Source #

Monadic indexing

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

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

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

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

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

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

Extracting subvectors (slicing)

slice :: Unboxable a => Int -> Int -> Vector a -> Vector a Source #

take :: Unboxable a => Int -> Vector a -> Vector a Source #

drop :: Unboxable a => Int -> Vector a -> Vector a Source #

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

Construction

Initialisation

replicate :: Unboxable a => Int -> a -> Vector a Source #

generate :: Unboxable a => Int -> (Int -> a) -> Vector a Source #

iterateN :: Unboxable a => Int -> (a -> a) -> a -> Vector a Source #

Monadic initialisation

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

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

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

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

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

Unfolding

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

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

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

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

constructN :: Unboxable a => Int -> (Vector a -> a) -> Vector a Source #

constructrN :: Unboxable a => Int -> (Vector a -> a) -> Vector a Source #

Enumeration

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

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

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

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

Concatenation

cons :: Unboxable a => a -> Vector a -> Vector a Source #

snoc :: Unboxable a => Vector a -> a -> Vector a Source #

(++) :: Unboxable a => Vector a -> Vector a -> Vector a Source #

Restricting memory usage

Modifying vectors

Bulk updates

(//) :: Unboxable a => Vector a -> [(Int, a)] -> Vector a Source #

update :: Unboxable a => Vector a -> Vector (Int, a) -> Vector a Source #

unsafeUpd :: Unboxable a => Vector a -> [(Int, a)] -> Vector a Source #

Accumulations

accum :: Unboxable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a Source #

accumulate :: (Unboxable a, Unboxable b) => (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a Source #

accumulate_ :: (Unboxable a, Unboxable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a Source #

unsafeAccum :: Unboxable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a Source #

unsafeAccumulate :: (Unboxable a, Unboxable b) => (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a Source #

unsafeAccumulate_ :: (Unboxable a, Unboxable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a Source #

Permutations

Safe destructive updates

modify :: Unboxable a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a Source #

Elementwise operations

Indexing

Mapping

map :: (Unboxable a, Unboxable b) => (a -> b) -> Vector a -> Vector b Source #

imap :: (Unboxable a, Unboxable b) => (Int -> a -> b) -> Vector a -> Vector b Source #

concatMap :: (Unboxable a, Unboxable b) => (a -> Vector b) -> Vector a -> Vector b Source #

Monadic mapping

mapM :: (Monad m, Unboxable a, Unboxable b) => (a -> m b) -> Vector a -> m (Vector b) Source #

imapM :: (Monad m, Unboxable a, Unboxable b) => (Int -> a -> m b) -> Vector a -> m (Vector b) Source #

mapM_ :: (Monad m, Unboxable a) => (a -> m b) -> Vector a -> m () Source #

imapM_ :: (Monad m, Unboxable a) => (Int -> a -> m b) -> Vector a -> m () Source #

forM :: (Monad m, Unboxable a, Unboxable b) => Vector a -> (a -> m b) -> m (Vector b) Source #

forM_ :: (Monad m, Unboxable a) => Vector a -> (a -> m b) -> m () Source #

Zipping

zipWith :: (Unboxable a, Unboxable b, Unboxable c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c Source #

zipWith3 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d Source #

zipWith4 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e Source #

zipWith5 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e, Unboxable f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f Source #

zipWith6 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e, Unboxable f, Unboxable g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g Source #

izipWith :: (Unboxable a, Unboxable b, Unboxable c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c Source #

izipWith3 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d Source #

izipWith4 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e Source #

izipWith5 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e, Unboxable f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f Source #

izipWith6 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e, Unboxable f, Unboxable g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g Source #

zip :: (Unboxable a, Unboxable b) => Vector a -> Vector b -> Vector (a, b) Source #

zip3 :: (Unboxable a, Unboxable b, Unboxable c) => Vector a -> Vector b -> Vector c -> Vector (a, b, c) Source #

zip4 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d) => Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d) Source #

zip5 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e) Source #

zip6 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e, Unboxable f) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector (a, b, c, d, e, f) Source #

Monadic zipping

zipWithM :: (Monad m, Unboxable a, Unboxable b, Unboxable c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c) Source #

izipWithM :: (Monad m, Unboxable a, Unboxable b, Unboxable c) => (Int -> a -> b -> m c) -> Vector a -> Vector b -> m (Vector c) Source #

zipWithM_ :: (Monad m, Unboxable a, Unboxable b) => (a -> b -> m c) -> Vector a -> Vector b -> m () Source #

izipWithM_ :: (Monad m, Unboxable a, Unboxable b) => (Int -> a -> b -> m c) -> Vector a -> Vector b -> m () Source #

Unzipping

unzip :: (Unboxable a, Unboxable b) => Vector (a, b) -> (Vector a, Vector b) Source #

unzip3 :: (Unboxable a, Unboxable b, Unboxable c) => Vector (a, b, c) -> (Vector a, Vector b, Vector c) Source #

unzip4 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d) => Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d) Source #

unzip5 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e) => Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e) Source #

unzip6 :: (Unboxable a, Unboxable b, Unboxable c, Unboxable d, Unboxable e, Unboxable f) => Vector (a, b, c, d, e, f) -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f) Source #

Working with predicates

Filtering

filter :: Unboxable a => (a -> Bool) -> Vector a -> Vector a Source #

ifilter :: Unboxable a => (Int -> a -> Bool) -> Vector a -> Vector a Source #

uniq :: (Eq a, Unboxable a) => Vector a -> Vector a Source #

mapMaybe :: (Unboxable a, Unboxable b) => (a -> Maybe b) -> Vector a -> Vector b Source #

imapMaybe :: (Unboxable a, Unboxable b) => (Int -> a -> Maybe b) -> Vector a -> Vector b Source #

filterM :: (Monad m, Unboxable a) => (a -> m Bool) -> Vector a -> m (Vector a) Source #

takeWhile :: Unboxable a => (a -> Bool) -> Vector a -> Vector a Source #

dropWhile :: Unboxable a => (a -> Bool) -> Vector a -> Vector a Source #

Partitioning

partition :: Unboxable a => (a -> Bool) -> Vector a -> (Vector a, Vector a) Source #

unstablePartition :: Unboxable a => (a -> Bool) -> Vector a -> (Vector a, Vector a) Source #

span :: Unboxable a => (a -> Bool) -> Vector a -> (Vector a, Vector a) Source #

break :: Unboxable a => (a -> Bool) -> Vector a -> (Vector a, Vector a) Source #

Searching

elem :: (Eq a, Unboxable a) => a -> Vector a -> Bool Source #

notElem :: (Eq a, Unboxable a) => a -> Vector a -> Bool Source #

find :: Unboxable a => (a -> Bool) -> Vector a -> Maybe a Source #

findIndex :: Unboxable a => (a -> Bool) -> Vector a -> Maybe Int Source #

elemIndex :: (Eq a, Unboxable a) => a -> Vector a -> Maybe Int Source #

elemIndices :: (Eq a, Unboxable a) => a -> Vector a -> Vector Int Source #

Folding

foldl :: Unboxable b => (a -> b -> a) -> a -> Vector b -> a Source #

foldl1 :: Unboxable a => (a -> a -> a) -> Vector a -> a Source #

foldl' :: Unboxable b => (a -> b -> a) -> a -> Vector b -> a Source #

foldl1' :: Unboxable a => (a -> a -> a) -> Vector a -> a Source #

foldr :: Unboxable a => (a -> b -> b) -> b -> Vector a -> b Source #

foldr1 :: Unboxable a => (a -> a -> a) -> Vector a -> a Source #

foldr' :: Unboxable a => (a -> b -> b) -> b -> Vector a -> b Source #

foldr1' :: Unboxable a => (a -> a -> a) -> Vector a -> a Source #

ifoldl :: Unboxable b => (a -> Int -> b -> a) -> a -> Vector b -> a Source #

ifoldl' :: Unboxable b => (a -> Int -> b -> a) -> a -> Vector b -> a Source #

ifoldr :: Unboxable a => (Int -> a -> b -> b) -> b -> Vector a -> b Source #

ifoldr' :: Unboxable a => (Int -> a -> b -> b) -> b -> Vector a -> b Source #

Specialised folds

all :: Unboxable a => (a -> Bool) -> Vector a -> Bool Source #

any :: Unboxable a => (a -> Bool) -> Vector a -> Bool Source #

sum :: (Num a, Unboxable a) => Vector a -> a Source #

product :: (Num a, Unboxable a) => Vector a -> a Source #

maximum :: (Ord a, Unboxable a) => Vector a -> a Source #

maximumBy :: Unboxable a => (a -> a -> Ordering) -> Vector a -> a Source #

minimum :: (Ord a, Unboxable a) => Vector a -> a Source #

minimumBy :: Unboxable a => (a -> a -> Ordering) -> Vector a -> a Source #

minIndex :: (Ord a, Unboxable a) => Vector a -> Int Source #

minIndexBy :: Unboxable a => (a -> a -> Ordering) -> Vector a -> Int Source #

maxIndex :: (Ord a, Unboxable a) => Vector a -> Int Source #

maxIndexBy :: Unboxable a => (a -> a -> Ordering) -> Vector a -> Int Source #

Monadic folds

foldM :: (Monad m, Unboxable b) => (a -> b -> m a) -> a -> Vector b -> m a Source #

ifoldM :: (Monad m, Unboxable b) => (a -> Int -> b -> m a) -> a -> Vector b -> m a Source #

foldM' :: (Monad m, Unboxable b) => (a -> b -> m a) -> a -> Vector b -> m a Source #

ifoldM' :: (Monad m, Unboxable b) => (a -> Int -> b -> m a) -> a -> Vector b -> m a Source #

fold1M :: (Monad m, Unboxable a) => (a -> a -> m a) -> Vector a -> m a Source #

fold1M' :: (Monad m, Unboxable a) => (a -> a -> m a) -> Vector a -> m a Source #

foldM_ :: (Monad m, Unboxable b) => (a -> b -> m a) -> a -> Vector b -> m () Source #

ifoldM_ :: (Monad m, Unboxable b) => (a -> Int -> b -> m a) -> a -> Vector b -> m () Source #

foldM'_ :: (Monad m, Unboxable b) => (a -> b -> m a) -> a -> Vector b -> m () Source #

ifoldM'_ :: (Monad m, Unboxable b) => (a -> Int -> b -> m a) -> a -> Vector b -> m () Source #

fold1M_ :: (Monad m, Unboxable a) => (a -> a -> m a) -> Vector a -> m () Source #

fold1M'_ :: (Monad m, Unboxable a) => (a -> a -> m a) -> Vector a -> m () Source #

Prefix sums (scans)

prescanl :: (Unboxable a, Unboxable b) => (a -> b -> a) -> a -> Vector b -> Vector a Source #

prescanl' :: (Unboxable a, Unboxable b) => (a -> b -> a) -> a -> Vector b -> Vector a Source #

postscanl :: (Unboxable a, Unboxable b) => (a -> b -> a) -> a -> Vector b -> Vector a Source #

postscanl' :: (Unboxable a, Unboxable b) => (a -> b -> a) -> a -> Vector b -> Vector a Source #

scanl :: (Unboxable a, Unboxable b) => (a -> b -> a) -> a -> Vector b -> Vector a Source #

scanl' :: (Unboxable a, Unboxable b) => (a -> b -> a) -> a -> Vector b -> Vector a Source #

scanl1 :: Unboxable a => (a -> a -> a) -> Vector a -> Vector a Source #

scanl1' :: Unboxable a => (a -> a -> a) -> Vector a -> Vector a Source #

iscanl :: (Unboxable a, Unboxable b) => (Int -> a -> b -> a) -> a -> Vector b -> Vector a Source #

iscanl' :: (Unboxable a, Unboxable b) => (Int -> a -> b -> a) -> a -> Vector b -> Vector a Source #

prescanr :: (Unboxable a, Unboxable b) => (a -> b -> b) -> b -> Vector a -> Vector b Source #

prescanr' :: (Unboxable a, Unboxable b) => (a -> b -> b) -> b -> Vector a -> Vector b Source #

postscanr :: (Unboxable a, Unboxable b) => (a -> b -> b) -> b -> Vector a -> Vector b Source #

postscanr' :: (Unboxable a, Unboxable b) => (a -> b -> b) -> b -> Vector a -> Vector b Source #

scanr :: (Unboxable a, Unboxable b) => (a -> b -> b) -> b -> Vector a -> Vector b Source #

scanr' :: (Unboxable a, Unboxable b) => (a -> b -> b) -> b -> Vector a -> Vector b Source #

scanr1 :: Unboxable a => (a -> a -> a) -> Vector a -> Vector a Source #

scanr1' :: Unboxable a => (a -> a -> a) -> Vector a -> Vector a Source #

iscanr :: (Unboxable a, Unboxable b) => (Int -> a -> b -> b) -> b -> Vector a -> Vector b Source #

iscanr' :: (Unboxable a, Unboxable b) => (Int -> a -> b -> b) -> b -> Vector a -> Vector b Source #

Conversions

Lists

toList :: Unboxable a => Vector a -> [a] Source #

fromList :: Unboxable a => [a] -> Vector a Source #

fromListN :: Unboxable a => Int -> [a] -> Vector a Source #

Other vector types

convert :: (Vector v a, Vector w a) => v a -> w a #

O(n) Convert different vector types

toUnboxedVector :: (Unboxable a, Rep a ~ a, IsTrivial a ~ True) => Vector a -> Vector a Source #

fromUnboxedVector :: (Unboxable a, Rep a ~ a, IsTrivial a ~ True) => Vector a -> Vector a Source #

coercionWithUnboxedVector :: (Unboxable a, Rep a ~ a, IsTrivial a ~ True) => Coercion (Vector a) (Vector a) Source #

coerceVector :: (Coercible a b, Unboxable a, Unboxable b, CoercibleRep a ~ CoercibleRep b, Rep a ~ Rep b) => Vector a -> Vector b Source #

liftCoercion :: (Unboxable a, Unboxable b, CoercibleRep a ~ CoercibleRep b, Rep a ~ Rep b) => Coercion a b -> Coercion (Vector a) (Vector b) Source #

vectorCoercion :: (Coercible a b, Unboxable a, Unboxable b, CoercibleRep a ~ CoercibleRep b, Rep a ~ Rep b) => Coercion (Vector a) (Vector b) Source #

Mutable vectors

thaw :: (PrimMonad m, Unboxable a) => Vector a -> m (MVector (PrimState m) a) Source #

copy :: (PrimMonad m, Unboxable a) => MVector (PrimState m) a -> Vector a -> m () Source #

unsafeCopy :: (PrimMonad m, Unboxable a) => MVector (PrimState m) a -> Vector a -> m () Source #