nonempty-vector-0.2.4: Non-empty vectors

Copyright | (c) 2019-2024 Emily Pillmore
License | BSD-style
Maintainer | Emily Pillmore <emilypi@cohomolo.gy>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Data.Vector.NonEmpty.Internal

Contents

- Immutable boxed vectors
- Mutable boxed vectors
  - Mutable vector aliases

Description

Internal module exposing the constructors for `NonEmptyVector` and `NonEmptyMVector`.

Warning: Since the constructors are exposed here, by using this module, you take on the risks that you break the non-emptiness invariants of the main modules. Use at your own risk.

Since: 0.2.1.0

Synopsis

- newtype NonEmptyVector a = NonEmptyVector {
  - _neVec :: Vector a
  }
- newtype NonEmptyMVector s a = NonEmptyMVector {
  - _nemVec :: MVector s a
  }
- type NonEmptyIOVector = NonEmptyMVector RealWorld
- type NonEmptySTVector s = NonEmptyMVector s

# Immutable boxed vectors

newtype NonEmptyVector a Source #

`NonEmptyVector` is a thin wrapper around `Vector` that witnesses an API requiring non-empty construction, initialization, and generation of non-empty vectors by design.

A newtype wrapper was chosen so that no new pointer indirection is introduced when working with `Vector`s, and all performance characteristics inherited from the `Vector` API still apply.

Since: 0.2.1.0

Constructors

NonEmptyVector |

Fields

- _neVec :: Vector a

#### Instances

Instances details

MonadZip NonEmptyVector Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods mzip :: NonEmptyVector a -> NonEmptyVector b -> NonEmptyVector (a, b) Source # mzipWith :: (a -> b -> c) -> NonEmptyVector a -> NonEmptyVector b -> NonEmptyVector c Source # munzip :: NonEmptyVector (a, b) -> (NonEmptyVector a, NonEmptyVector b) Source #
Foldable1 NonEmptyVector Source # |

Instance details

Defined in Data.Vector.NonEmpty.Internal

Methods

fold1 :: Semigroup m => NonEmptyVector m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> NonEmptyVector a -> m Source #

foldMap1' :: Semigroup m => (a -> m) -> NonEmptyVector a -> m Source #

toNonEmpty :: NonEmptyVector a -> NonEmpty a Source #

maximum :: Ord a => NonEmptyVector a -> a Source #

minimum :: Ord a => NonEmptyVector a -> a Source #

head :: NonEmptyVector a -> a Source #

last :: NonEmptyVector a -> a Source #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> NonEmptyVector a -> b Source #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> NonEmptyVector a -> b Source #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> NonEmptyVector a -> b Source #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> NonEmptyVector a -> b Source #

Eq1 NonEmptyVector Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods liftEq :: (a -> b -> Bool) -> NonEmptyVector a -> NonEmptyVector b -> Bool Source #
Ord1 NonEmptyVector Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods liftCompare :: (a -> b -> Ordering) -> NonEmptyVector a -> NonEmptyVector b -> Ordering Source #
Read1 NonEmptyVector Source # |

Instance details

Defined in Data.Vector.NonEmpty.Internal

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (NonEmptyVector a) Source #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [NonEmptyVector a] Source #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (NonEmptyVector a) Source #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [NonEmptyVector a] Source #

Show1 NonEmptyVector Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NonEmptyVector a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [NonEmptyVector a] -> ShowS Source #
Applicative NonEmptyVector Source # |

Instance details

Defined in Data.Vector.NonEmpty.Internal

Methods

pure :: a -> NonEmptyVector a Source #

(<*>) :: NonEmptyVector (a -> b) -> NonEmptyVector a -> NonEmptyVector b Source #

liftA2 :: (a -> b -> c) -> NonEmptyVector a -> NonEmptyVector b -> NonEmptyVector c Source #

(*>) :: NonEmptyVector a -> NonEmptyVector b -> NonEmptyVector b Source #

(<*) :: NonEmptyVector a -> NonEmptyVector b -> NonEmptyVector a Source #

Functor NonEmptyVector Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods fmap :: (a -> b) -> NonEmptyVector a -> NonEmptyVector b Source # (<$) :: a -> NonEmptyVector b -> NonEmptyVector a Source #
Monad NonEmptyVector Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods (>>=) :: NonEmptyVector a -> (a -> NonEmptyVector b) -> NonEmptyVector b Source # (>>) :: NonEmptyVector a -> NonEmptyVector b -> NonEmptyVector b Source # return :: a -> NonEmptyVector a Source #
Foldable NonEmptyVector Source # |

Instance details

Defined in Data.Vector.NonEmpty.Internal

Methods

fold :: Monoid m => NonEmptyVector m -> m Source #

foldMap :: Monoid m => (a -> m) -> NonEmptyVector a -> m Source #

foldMap' :: Monoid m => (a -> m) -> NonEmptyVector a -> m Source #

foldr :: (a -> b -> b) -> b -> NonEmptyVector a -> b Source #

foldr' :: (a -> b -> b) -> b -> NonEmptyVector a -> b Source #

foldl :: (b -> a -> b) -> b -> NonEmptyVector a -> b Source #

foldl' :: (b -> a -> b) -> b -> NonEmptyVector a -> b Source #

foldr1 :: (a -> a -> a) -> NonEmptyVector a -> a Source #

foldl1 :: (a -> a -> a) -> NonEmptyVector a -> a Source #

toList :: NonEmptyVector a -> [a] Source #

null :: NonEmptyVector a -> Bool Source #

length :: NonEmptyVector a -> Int Source #

elem :: Eq a => a -> NonEmptyVector a -> Bool Source #

maximum :: Ord a => NonEmptyVector a -> a Source #

minimum :: Ord a => NonEmptyVector a -> a Source #

sum :: Num a => NonEmptyVector a -> a Source #

product :: Num a => NonEmptyVector a -> a Source #

Traversable NonEmptyVector Source # |

Instance details

Defined in Data.Vector.NonEmpty.Internal

Methods

traverse :: Applicative f => (a -> f b) -> NonEmptyVector a -> f (NonEmptyVector b) Source #

sequenceA :: Applicative f => NonEmptyVector (f a) -> f (NonEmptyVector a) Source #

mapM :: Monad m => (a -> m b) -> NonEmptyVector a -> m (NonEmptyVector b) Source #

sequence :: Monad m => NonEmptyVector (m a) -> m (NonEmptyVector a) Source #

NFData a => NFData (NonEmptyVector a) Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods rnf :: NonEmptyVector a -> () Source #
Semigroup (NonEmptyVector a) Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods (<>) :: NonEmptyVector a -> NonEmptyVector a -> NonEmptyVector a Source # sconcat :: NonEmpty (NonEmptyVector a) -> NonEmptyVector a Source # stimes :: Integral b => b -> NonEmptyVector a -> NonEmptyVector a Source #
Data a => Data (NonEmptyVector a) Source # |

Instance details

Defined in Data.Vector.NonEmpty.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NonEmptyVector a -> c (NonEmptyVector a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (NonEmptyVector a) Source #

toConstr :: NonEmptyVector a -> Constr Source #

dataTypeOf :: NonEmptyVector a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (NonEmptyVector a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NonEmptyVector a)) Source #

gmapT :: (forall b. Data b => b -> b) -> NonEmptyVector a -> NonEmptyVector a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NonEmptyVector a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NonEmptyVector a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> NonEmptyVector a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> NonEmptyVector a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> NonEmptyVector a -> m (NonEmptyVector a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmptyVector a -> m (NonEmptyVector a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmptyVector a -> m (NonEmptyVector a) Source #

Read a => Read (NonEmptyVector a) Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods readsPrec :: Int -> ReadS (NonEmptyVector a) Source # readList :: ReadS [NonEmptyVector a] Source # readPrec :: ReadPrec (NonEmptyVector a) Source # readListPrec :: ReadPrec [NonEmptyVector a] Source #
Show a => Show (NonEmptyVector a) Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods showsPrec :: Int -> NonEmptyVector a -> ShowS Source # show :: NonEmptyVector a -> String Source # showList :: [NonEmptyVector a] -> ShowS Source #
Eq a => Eq (NonEmptyVector a) Source # |
Instance details Defined in Data.Vector.NonEmpty.Internal Methods (==) :: NonEmptyVector a -> NonEmptyVector a -> Bool Source # (/=) :: NonEmptyVector a -> NonEmptyVector a -> Bool Source #
Ord a => Ord (NonEmptyVector a) Source # |

Instance details

Defined in Data.Vector.NonEmpty.Internal

Methods

compare :: NonEmptyVector a -> NonEmptyVector a -> Ordering Source #

(<) :: NonEmptyVector a -> NonEmptyVector a -> Bool Source #

(<=) :: NonEmptyVector a -> NonEmptyVector a -> Bool Source #

(>) :: NonEmptyVector a -> NonEmptyVector a -> Bool Source #

(>=) :: NonEmptyVector a -> NonEmptyVector a -> Bool Source #

max :: NonEmptyVector a -> NonEmptyVector a -> NonEmptyVector a Source #

min :: NonEmptyVector a -> NonEmptyVector a -> NonEmptyVector a Source #

# Mutable boxed vectors

newtype NonEmptyMVector s a Source #

`NonEmptyMVector` is a thin wrapper around `MVector` that witnesses an API requiring non-empty construction, initialization, and generation of non-empty vectors by design.

A newtype wrapper was chosen so that no new pointer indirection is introduced when working with `MVector`s, and all performance characteristics inherited from the `MVector` API still apply.

Since: 0.2.1.0

Constructors

NonEmptyMVector |

Fields

- _nemVec :: MVector s a

## Mutable vector aliases

type NonEmptyIOVector = NonEmptyMVector RealWorld Source #

`NonEmptyMVector` parametrized by `PrimState`

Since: 0.2.1.0

type NonEmptySTVector s = NonEmptyMVector s Source #

`NonEmptyMVector` parametrized by `ST`

Since: 0.2.1.0