GeezerVison is showing hackage.haskell.org — vector
vector: Efficient Arrays
library vectorlibrary vector:benchmarks-O2Modules[Index] [Quick Jump] - Bench
- Vector
- Algo
- Bench.Vector.Algo.AwShCC
- Bench.Vector.Algo.FindIndexR
- Bench.Vector.Algo.HybCC
- Bench.Vector.Algo.Leaffix
- Bench.Vector.Algo.ListRank
- Bench.Vector.Algo.MutableSet
- Bench.Vector.Algo.NextPermutation
- Bench.Vector.Algo.Quickhull
- Bench.Vector.Algo.Rootfix
- Bench.Vector.Algo.Spectral
- Bench.Vector.Algo.Tridiag
- Bench.Vector.Tasty
- TestData
- Bench.Vector.TestData.Graph
- Bench.Vector.TestData.ParenTree
FlagsManual Flags| Name | Description | Default |
|---|
| boundschecks | Enable bounds checking | Enabled | | unsafechecks | Enable bounds checking in unsafe operations at the cost of a
significant performance penalty | Disabled | | internalchecks | Enable internal consistency checks at the cost of a
significant performance penalty | Disabled | | wall | Enable all -Wall warnings | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
DownloadsNote: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees
Candidates
| Versions [RSS] |
0.1, 0.2, 0.3, 0.3.1, 0.4, 0.4.1, 0.4.2, 0.5, 0.6, 0.6.0.1, 0.6.0.2, 0.7, 0.7.0.1, 0.7.1, 0.8, 0.9, 0.9.1, 0.10, 0.10.0.1, 0.10.9.0, 0.10.9.1, 0.10.9.2, 0.10.9.3, 0.10.10.0, 0.10.11.0, 0.10.12.0, 0.10.12.1, 0.10.12.2, 0.10.12.3, 0.11.0.0, 0.12.0.0, 0.12.0.1, 0.12.0.2, 0.12.0.3, 0.12.1.0, 0.12.1.1, 0.12.1.2, 0.12.2.0, 0.12.3.0, 0.12.3.1, 0.13.0.0, 0.13.1.0, 0.13.2.0 (info) |
| Change log |
changelog.md |
| Dependencies |
base (>=4.9 && <4.23), deepseq (>=1.1 && <1.6), primitive (>=0.6.4.0 && <0.10), random (>=1.2), tasty, vector, vector-stream (>=0.1 && <0.2) [details] |
| Tested with |
ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.4, ghc ==8.10.7, ghc ==9.0.2, ghc ==9.2.8, ghc ==9.4.8, ghc ==9.6.4, ghc ==9.8.2
|
| License |
BSD-3-Clause |
| Copyright |
(c) Roman Leshchinskiy 2008-2012,
Alexey Kuleshevich 2020-2022,
Aleksey Khudyakov 2020-2022,
Andrew Lelechenko 2020-2022 |
| Author |
Roman Leshchinskiy <[email protected]> |
| Maintainer |
Haskell Libraries Team <[email protected]>
Alexey Kuleshevich <[email protected]>,
Aleksey Khudyakov <[email protected]>,
Andrew Lelechenko <[email protected]> |
| Uploaded |
by AlexeyKhudyakov at 2024-10-31T18:01:59Z |
| Revised |
Revision 5 made by AlexeyKhudyakov at 2026-06-17T10:59:00Z |
| Category |
Data, Data Structures |
| Home page |
https://github.com/haskell/vector
|
| Bug tracker |
https://github.com/haskell/vector/issues
|
| Source repo |
head: git clone https://github.com/haskell/vector.git(vector) |
| Distributions |
Arch:0.13.2.0, Fedora:0.13.2.0, LTSHaskell:0.13.2.0, Stackage:0.13.2.0 |
| Reverse Dependencies |
2347 direct, 14132 indirect [details] |
| Downloads |
428031 total (492 in the last 30 days) |
| Rating |
2.75 (votes: 14)
[estimated by Bayesian average] |
| Your Rating |
|
| Status |
Docs uploaded by user Last success reported on 2026-03-16 [all 3 reports] |
Readme for vector-0.13.2.0
[ back to package description]
The vector package 
Vector is a collection of efficient Int-indexed array implementations:
boxed, unboxed, storable, and primitive vectors
(all can be mutable or immutable). The package features a generic API,
polymorphic in vector type, and implements stream fusion,
a powerful optimisation framework that can help eliminate intermediate data structures.
Table of Contents
Tutorial
A beginner-friendly tutorial for vectors can be found on
MMHaskell.
If you have already started your adventure with vectors,
the tutorial on Haskell Wiki
covers more ground.
Vector vs Array
Arrays are data structures that can store a multitude of elements
and allow immediate access to every one of them. However, they are
often seen as legacy constructs that are rarely used in modern Haskell.
Even though Haskell has a built-in Data.Array module,
arrays might be a bit overwhelming to use due to their complex API.
Conversely, vectors incorporate the array’s O(1) access to elements
with a much friendlier API of lists. Since they allow for framework
optimisation via loop fusion, vectors emphasise efficiency and keep
a rich interface. Unless you’re confident with arrays, it’s
well-advised to use vectors when looking for a similar functionality.
Vectors Available in the Package
Lazy boxed vectors (Data.Vector) store each of their elements as a
pointer to a heap-allocated value. Because of indirection, lazy boxed vectors
are slower in comparison to unboxed vectors.
Strict boxed vectors (Data.Vector.Strict) contain elements that are
strictly evaluated.
Unboxed vectors (Data.Vector.Unboxed) determine an array's representation
from its elements' type. For example, vector of primitive types (e.g. Int) will be
backed by primitive array while vector of product types by structure of arrays.
They are quite efficient due to the unboxed representation they use.
Storable vectors (Data.Vector.Storable) are backed by pinned memory, i.e.,
they cannot be moved by the garbage collector. Their primary use case is C FFI.
Primitive vectors (Data.Vector.Primitive) are backed by simple byte array and
can store only data types that are represented in memory as a sequence of bytes without
a pointer, i.e., they belong to the Prim type class, e.g., Int, Double, etc.
It's advised to use unboxed vectors if you're looking for the performance of primitive vectors,
but more versality.
Stream Fusion
An optimisation framework used by vectors, stream fusion is a technique that merges
several functions into one and prevents creation of intermediate data structures. For example,
the expression sum . filter g . map f won't allocate temporary vectors if
compiled with optimisations.
|