How it works...

When compared to list, map, and set, vector proposes a very different approach. It is a very efficient collection and most access operations are done with O(1) access. The vector is used in many efficient libraries such as aeson ( a popular library for dealing with JSON), where efficiency and random access is required. The vector itself is immutable and provides effective subsetting through list-like operations.

The mutable vector, on the other hand ,works through monad, by allowing us to programmatically construct the vector and then freeze it to convert it to an immutable vector.