fromList package:vector

O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
Create a Bundle from a list
Convert a list to a Bundle
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
O(n) Convert the first n elements of a list to a vector. It's expected that the supplied list will be exactly n elements long. As an optimization, this function allocates a buffer for n elements, which could be used for DoS-attacks by exhausting the memory if an attacker controls that parameter.
fromListN n xs = fromList (take n xs)
Create a Bundle from the first n elements of a list
fromListN n xs = fromList (take n xs)
Convert the first n elements of a list to a Bundle
O(n) Convert the first n elements of a list to a vector. It's expected that the supplied list will be exactly n elements long. As an optimization, this function allocates a buffer for n elements, which could be used for DoS-attacks by exhausting the memory if an attacker controls that parameter.
fromListN n xs = fromList (take n xs)

Examples

>>> import qualified Data.Vector.Strict as V

>>> V.fromListN 3 [1,2,3,4,5]
[1,2,3]

>>> V.fromListN 3 [1]
[1]
O(n) Convert the first n elements of a list to a vector. It's expected that the supplied list will be exactly n elements long. As an optimization, this function allocates a buffer for n elements, which could be used for DoS-attacks by exhausting the memory if an attacker controls that parameter.
fromListN n xs = fromList (take n xs)

Examples

>>> import qualified Data.Vector.Primitive as VP

>>> VP.fromListN 3 [1,2,3,4,5 :: Int]
[1,2,3]

>>> VP.fromListN 3 [1 :: Int]
[1]
O(n) Convert the first n elements of a list to a vector. It's expected that the supplied list will be exactly n elements long. As an optimization, this function allocates a buffer for n elements, which could be used for DoS-attacks by exhausting the memory if an attacker controls that parameter.
fromListN n xs = fromList (take n xs)

Examples

>>> import qualified Data.Vector.Storable as VS

>>> VS.fromListN 3 [1,2,3,4,5 :: Int]
[1,2,3]

>>> VS.fromListN 3 [1 :: Int]
[1]
O(n) Convert the first n elements of a list to a vector. It's expected that the supplied list will be exactly n elements long. As an optimization, this function allocates a buffer for n elements, which could be used for DoS-attacks by exhausting the memory if an attacker controls that parameter.
fromListN n xs = fromList (take n xs)

Examples

>>> import qualified Data.Vector.Unboxed as VU

>>> VU.fromListN 3 [1,2,3,4,5 :: Int]
[1,2,3]

>>> VU.fromListN 3 [1 :: Int]
[1]
Convert a list to a Bundle with the given Size hint.