BSD-3-Clause licensed by Emily Pillmore
Maintained by [email protected]
This version can be pinned in stack with:nonempty-vector-1.0@sha256:08418c11cebe72924e234c81e231f1524c976f73798b6e421385e2ac1a429857,2531
Used by 2 packages in nightly-2026-11-07(full list with versions):

Non-empty Vectors

Build Status Hackage

This package provides thin wrappers around mutable and immutable vector types that enforce non-emptiness, with APIs for both boxed and unboxed storage.

Storage Immutable Mutable
Boxed Data.Vector.NonEmpty Data.Vector.NonEmpty.Mutable
Unboxed Data.Vector.NonEmpty.Unboxed Data.Vector.NonEmpty.Unboxed.Mutable

The unboxed API requires Unbox instances for element types. Operations that can produce an empty result return an ordinary vector or Maybe, as appropriate. The Internal modules expose constructors for users who manage the non-emptiness invariant themselves.

Library dependencies are base, deepseq, primitive, and vector.

Changes

Revision history for nonempty-vector

1.0

  • Add immutable and mutable unboxed non-empty vectors in Data.Vector.NonEmpty.Unboxed and Data.Vector.NonEmpty.Unboxed.Mutable. Constructors are available through Data.Vector.NonEmpty.Unboxed.Internal.
  • Add property tests for the unboxed API
  • Delegate boxed Foldable methods to the underlying vector and specialize Foldable1 operations, including strict folding and non-empty conversion.

Thanks to Koz Ross (@kozross) for the unboxed API!

0.3

  • Add group and groupBy, returning non-empty lists of non-empty vector slices.
  • Add intersperse.
  • Expand property tests across the immutable and mutable APIs, including grouping, construction, conversions, folds, scans, and type class instances.
  • Support GHC 9.14 and base < 4.23; update the CI matrix for GHC 9.4–9.14.
  • Fix Haddock references and restore the BSD-3-Clause license text.

0.2.3

  • Support GHC 9.8.x

0.2.2.0

  • Drop support for GHC<8.10, update CI, bump bounds for primitive.
  • Added partitionWith from vector. (#11) - Thanks @AlistairB!

0.2.1.0

  • Added consV and snocV primitives for consing a vector to create a nonempty one. (#8) - Thanks @AlistairB!
  • Updated CI and cabal support
  • Expose constructors in new Data.Vector.NonEmpty.Internal module
  • Modules are now marked trustworthy
  • @since annotations have been added.

0.2.0.2

  • Removed spurious dependency on semigroups

0.2.0.1

  • Missed a strictness tick in postscanl'

  • INLINE pragma for slice

0.2.0.0

  • Remove naughty Generic, and Alternative instances as they can construct empty NonEmptyVectors

  • Handwritten Read and Read1 instances with safe cons

  • Added uncons, unsnoc, replicate1, generate1, iterateN1, unsafeCreate, unsafeCreateT, unfoldr1, unfoldr1N, unfoldr1M, unfoldr1NM,

  • Added unsafeFromList, unsafeFromVector, and fromNonEmptyN1

  • Add ifilterM

  • Add doctests for all new functions + many familiar ones

0.1.0.0

  • Remove MonadFail instance for the sake of backcompat with LTS < 13
  • Drop Cabal version down to 2.0

0.0.1.1 – 2019-10-20

  • Export toMVector and fromMVector
  • clean up docs

0.0.1.0 – 2019-10-20

  • First version. Released on an unsuspecting world.