Haskell Language The Data.Vector Module


Example

The Data.Vector module provided by the vector is a high performance library for working with arrays.

Once you've imported Data.Vector, it's easy to start using a Vector:

Prelude> import Data.Vector
Prelude Data.Vector> let a = fromList [2,3,4]
 
Prelude Data.Vector> a
fromList [2,3,4] :: Data.Vector.Vector
 
Prelude Data.Vector> :t a
a :: Vector Integer

You can even have a multi-dimensional array:

Prelude Data.Vector> let x = fromList [ fromList [1 .. x] | x <- [1..10] ]
 
Prelude Data.Vector> :t x
x :: Vector (Vector Integer)