h*lm      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0.1 Safe-Inferred%&'0-growable-vectorIndexingThe  type allows access to values by (0-based) index. An example will be more explicit:2vec <- fromFoldable @_ @Array @_ @Int [0, 2, 4, 6]two <- unsafeRead vec 1unsafeWrite vec 1 7seven <- unsafeRead vec 1 two + seven9However, be careful: if you try to access an index which isn't in the , your program will exhibit undefined behaviour ("UB"), either returning garbage or segfaulting. You cannot do this:  v <- fromFoldable [0, 2, 4, 6] unsafeRead v 6 -- this is UB If you want safe access, use  :2vec <- fromFoldable @_ @Array @_ @Int [0, 2, 4, 6] read vec 1Just 2 read vec 6NothingCapacity and reallocationThe capacity of a vector is the amount of space allocated for any future elements that will be added onto the vector. This is not to be confused with the length of a vector, which specifies the number of actual elements within the vector. If a vector's length exceeds its capacity, its capacity will automatically be increased, but its elements will have to be reallocated.For example, a vector with capacity 10 and length 0 would be an empty vector with space for 10 more elements. Pushing 10 or fewer elements onto the vector will not change its capacity or cause reallocation to occur. However, if the vector's length is increased to 11, it will have to reallocate, which can be slow. For this reason, it is recommended to use  whenever possible to specify how big the vector is expected to get. Guarantees is a (pointer, capacity, length) triplet. The pointer will never be null.Because of the semantics of the GHC runtime, creating a new vector will always allocate. In particular, if you construct a -backed  with capacity 0 via  0,  [], or  on an empty , the 16-byte header to GHC  will be allocated, but nothing else (for the curious: this is needed for  to work). Similarly, if you store zero-sized types inside such a ', it will not allocate space for them. Note that in this case the  may not report a  of 0.  will allocate if and only if 'sizeOf (undefined :: a)    0.If a  has allocated memory, then the memory it points to is on the heap (as defined by GHC's allocator), and its pointer points to  initialised, contiguous elements in order (i.e. what you would see if you turned it into a list), followed by   . logically uninitialised, contiguous elements. will never automatically shrink itself, even if completely empty. This ensures no unnecessary allocations or deallocations occur. Emptying a ) and then filling it back up to the same  should incur no calls to the allocator. If you wish to free up unused memory, use .  will never (re)allocate if the reported capacity is sufficient.   will (re)allocate if   . That is, the reported capacity is completely accurate, and can be relied on. Bulk insertion methods may% reallocate, even when not necessary. does not guarantee any particular growth strategy when reallocating when full, nor when  is called. The strategy is basic and may prove desirable to use a non-constant growth factor. Whatever strategy is used will of course guarantee O(1) amortised push. and  will produce a % with exactly the requested capacity. will not specifically overwrite any data that is removed from it, but also won't specifically preserve it. Its uninitialised memory is scratch space that it may use however it wants. It will generally just do whatever is most efficient or otherwise easy to implement. Do not rely on removed data to be erased for security purposes. Even if a  drops out of scope, its buffer may simply be reused by another . Even if you zero a s memory first, this may not actually happen when you think it does because of Garbage Collection.growable-vectorO(1). Constructs a new, empty  arr s a.vec <- new @_ @Array @_ @IntassertM (== 0) (length vec)assertM (== 0) (capacity vec)growable-vectorO(1). Constructs a new, empty  arr s a.(The vector will be able to hold exactly capacity elements without reallocating. It is important to note that althrough the returned vector has the capacity, specified, with vector will have a zero length. -vec <- withCapacity @_ @SmallArray @_ @Int 10-- The vector contains no items, even though it has capacity for moreassertM (== 0) (length vec)assertM (== 10) (capacity vec)--- These are all done without reallocating... forM_ [1..10] $ \i -> push vec iassertM (== 10) (length vec)assertM (== 10) (capacity vec),-- ..but this may make the vector reallocate push vec 11assertM (== 11) (length vec)assertM (>= 11) (capacity vec)growable-vectorO(1)/. Returns the number of elements in the vector.growable-vectorO(1). Returns the maximum number of elements the vector can hold without reallocating.-vec <- withCapacity @_ @PrimArray @_ @Word 10 push vec 42assertM (== 10) (capacity vec)growable-vectorO(n),. Reserves the minimum capacity for exactly  additional. more elements to be inserted in the given  arr s a. After calling /, capacity will be greater than or equal to length + additional8. Does nothing if the capacity is already sufficient.?Capacity cannot be relied upon to be precisely minimal. Prefer & if future insertions are expected.,vec <- fromFoldable @_ @Array @_ @Int @_ [1]reserveExact vec 10assertM (>= 11) (capacity vec)growable-vectorO(n)!. Reserves capacity for at least  additional. more elements to be inserted in the given  arr s a. The collection may reserve more space to avoid frequent reallocations. After calling /, capacity will be greater than or equal to length + additional4. Does nothing if capacity is already sufficient.0vec <- fromFoldable @_ @PrimArray @_ @Int @_ [1]reserve vec 10assertM (>= 11) (capacity vec)growable-vectorO(n)9. Shrinks the capacity of the vector as much as possible.(vec <- withCapacity @_ @Array @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkToFit vecassertM (== 3) (capacity vec)growable-vectorO(n)8. Shrinks the capacity of the vector with a lower bound.The capacity will remain at least as large as both the length and the supplied value.If the current capacity is less than the lower limit, this is a no-op.(vec <- withCapacity @_ @Array @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkTo vec 4assertM (>= 4) (capacity vec)shrinkTo vec 0assertM (>= 3) (capacity vec) growable-vectorO(1)+. Return the element at the given position.If the element index is out of bounds, this function will segfault.&The bounds are defined as [0, length).This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using   instead. growable-vectorO(1)/. Return the element at the given position, or " if the index is out of bounds.&The bounds are defined as [0, length). growable-vectorO(1)4. Write a value to the vector at the given position.;If the index is out of bounds, this function will segfault.The bounds are defined as [0, length). If you want to add an element past  length - 1, use   or ,, which can intelligently handle resizes.This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using   instead. growable-vectorO(1)4. Write a value to the vector at the given position.(If the index is in bounds, this returns  ()1. If the index is out of bounds, this returns .The bounds are defined as [0, length). If you want to add an element past  length - 1, use   or ,, which can intelligently handle resizes. growable-vector Amortised O(1)#. Appends an element to the vector.,vec <- fromFoldable @_ @Array @_ @Int [1, 2] push vec 3#assertM (== [1, 2, 3]) (toList vec)growable-vectorO(1)<. Removes the last element from a vector and returns it, or  if it is empty./vec <- fromFoldable @_ @Array @_ @Int [1, 2, 3]assertM (== Just 3) (pop vec) assertM (== [1, 2]) (toList vec)growable-vectorO(m).. Extend the vector with the elements of some  structure.6vec <- fromFoldable @_ @Array @_ @Char ['a', 'b', 'c']extend vec ['d', 'e', 'f']"assertM (== "abcdef") (toList vec)growable-vectorO(n),. Create a vector with the elements of some  structure.-vec <- fromFoldable @_ @Array @_ @Int [1..10]!assertM (== [1..10]) (toList vec)growable-vectorO(n)0. Create a list with the elements of the vector. vec <- new @_ @PrimArray @_ @Intextend vec [1..5] toList vec [1,2,3,4,5]growable-vectorO(n). Create a Primitive  copy of a vector.growable-vectorO(n). Create a Storable  copy of a vector.growable-vectorO(n). Create a lifted  copy of a vector.growable-vectorO(n). Create a Primitive  copy of a vector by applying a function to each element and its corresponding index.growable-vectorO(n). Create a Storable  copy of a vector by applying a function to each element and its corresponding index.growable-vectorO(n). Create a lifted  copy of a vector by applying a function to each element and its corresponding index.growable-vectorO(n)5. Map over an array, modifying the elements in place.-vec <- fromFoldable @_ @Array @_ @Int [1..10] map (+ 1) vec&assertM (== [2, 3 .. 11]) (toList vec)growable-vectorO(n)>. Map strictly over an array, modifying the elements in place.-vec <- fromFoldable @_ @Array @_ @Int [1..10]map' (* 2) vec&assertM (== [2, 4 .. 20]) (toList vec)growable-vectorO(n). Map over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.-vec <- fromFoldable @_ @Array @_ @Int [1..10]imap (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)growable-vectorO(n). Map strictly over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.-vec <- fromFoldable @_ @Array @_ @Int [1..10]imap' (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)growable-vectorcapacity   Safe-Inferred Y6growable-vectorIndexingThe  type allows access to values by (0-based) index. An example will be more explicit:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6]two <- unsafeRead vec 1unsafeWrite vec 1 7seven <- unsafeRead vec 1 two + seven9However, be careful: if you try to access an index which isn't in the , your program will exhibit undefined behaviour ("UB"), either returning garbage or segfaulting. You cannot do this:  v <- fromFoldable [0, 2, 4, 6] unsafeRead v 6 -- this is UB If you want safe access, use &:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6] read vec 1Just 2 read vec 6NothingCapacity and reallocationThe capacity of a vector is the amount of space allocated for any future elements that will be added onto the vector. This is not to be confused with the length of a vector, which specifies the number of actual elements within the vector. If a vector's length exceeds its capacity, its capacity will automatically be increased, but its elements will have to be reallocated.For example, a vector with capacity 10 and length 0 would be an empty vector with space for 10 more elements. Pushing 10 or fewer elements onto the vector will not change its capacity or cause reallocation to occur. However, if the vector's length is increased to 11, it will have to reallocate, which can be slow. For this reason, it is recommended to use  whenever possible to specify how big the vector is expected to get. Guarantees is a (pointer, capacity, length) triplet. The pointer will never be null.Because of the semantics of the GHC runtime, creating a new vector will always allocate. In particular, if you construct a -backed  with capacity 0 via  0, , [], or # on an empty , the 16-byte header to GHC  'ByteArray#' will be allocated, but nothing else (for the curious: this is needed for 'sameMutableByteArray#' to work). Similarly, if you store zero-sized types inside such a ', it will not allocate space for them. Note that in this case the  may not report a   of 0.  will allocate if and only if 'sizeOf (undefined :: a)     0.If a  has allocated memory, then the memory it points to is on the heap (as defined by GHC's allocator), and its pointer points to  initialised, contiguous elements in order (i.e. what you would see if you turned it into a list), followed by    . logically uninitialised, contiguous elements. will never automatically shrink itself, even if completely empty. This ensures no unnecessary allocations or deallocations occur. Emptying a ) and then filling it back up to the same  should incur no calls to the allocator. If you wish to free up unused memory, use #.) will never (re)allocate if the reported capacity is sufficient. ) will (re)allocate if    . That is, the reported capacity is completely accurate, and can be relied on. Bulk insertion methods may% reallocate, even when not necessary. does not guarantee any particular growth strategy when reallocating when full, nor when " is called. The strategy is basic and may prove desirable to use a non-constant growth factor. Whatever strategy is used will of course guarantee O(1) amortised push., and  will produce a % with exactly the requested capacity. will not specifically overwrite any data that is removed from it, but also won't specifically preserve it. Its uninitialised memory is scratch space that it may use however it wants. It will generally just do whatever is most efficient or otherwise easy to implement. Do not rely on removed data to be erased for security purposes. Even if a  drops out of scope, its buffer may simply be reused by another . Even if you zero a s memory first, this may not actually happen when you think it does because of Garbage Collection.growable-vectorO(1). Constructs a new, empty  s a.vec <- new @_ @_ @IntassertM (== 0) (length vec)assertM (== 0) (capacity vec)growable-vectorO(1). Constructs a new, empty  arr s a.(The vector will be able to hold exactly capacity elements without reallocating. It is important to note that althrough the returned vector has the capacity, specified, with vector will have a zero length. !vec <- withCapacity @_ @_ @Int 10-- The vector contains no items, even though it has capacity for moreassertM (== 0) (length vec)assertM (== 10) (capacity vec)--- These are all done without reallocating... forM_ [1..10] $ \i -> push vec iassertM (== 10) (length vec)assertM (== 10) (capacity vec),-- ..but this may make the vector reallocate push vec 11assertM (== 11) (length vec)assertM (>= 11) (capacity vec)growable-vectorO(1)/. Returns the number of elements in the vector. growable-vectorO(1). Returns the maximum number of elements the vector can hold without reallocating."vec <- withCapacity @_ @_ @Word 10 push vec 42assertM (== 10) (capacity vec)!growable-vectorO(n),. Reserves the minimum capacity for exactly  additional. more elements to be inserted in the given  s a. After calling !/, capacity will be greater than or equal to length + additional8. Does nothing if the capacity is already sufficient.?Capacity cannot be relied upon to be precisely minimal. Prefer "& if future insertions are expected.%vec <- fromFoldable @_ @_ @Int @_ [1]reserveExact vec 10assertM (>= 11) (capacity vec)"growable-vectorO(n)!. Reserves capacity for at least  additional. more elements to be inserted in the given  s a. The collection may reserve more space to avoid frequent reallocations. After calling "/, capacity will be greater than or equal to length + additional4. Does nothing if capacity is already sufficient.%vec <- fromFoldable @_ @_ @Int @_ [1]reserve vec 10assertM (>= 11) (capacity vec)#growable-vectorO(n)9. Shrinks the capacity of the vector as much as possible.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkToFit vecassertM (== 3) (capacity vec)$growable-vectorO(n)8. Shrinks the capacity of the vector with a lower bound.The capacity will remain at least as large as both the length and the supplied value.If the current capacity is less than the lower limit, this is a no-op.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkTo vec 4assertM (>= 4) (capacity vec)shrinkTo vec 0assertM (>= 3) (capacity vec)%growable-vectorO(1)+. Return the element at the given position.If the element index is out of bounds, this function will segfault.&The bounds are defined as [0, length).This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using & instead.&growable-vectorO(1)/. Return the element at the given position, or " if the index is out of bounds.&The bounds are defined as [0, length).'growable-vectorO(1)4. Write a value to the vector at the given position.;If the index is out of bounds, this function will segfault.The bounds are defined as [0, length). If you want to add an element past  length - 1, use ) or +,, which can intelligently handle resizes.This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using ( instead.(growable-vectorO(1)4. Write a value to the vector at the given position.(If the index is in bounds, this returns  ()1. If the index is out of bounds, this returns .The bounds are defined as [0, length). If you want to add an element past  length - 1, use ) or +,, which can intelligently handle resizes.)growable-vector Amortised O(1)#. Appends an element to the vector.%vec <- fromFoldable @_ @_ @Int [1, 2] push vec 3#assertM (== [1, 2, 3]) (toList vec)*growable-vectorO(1)<. Removes the last element from a vector and returns it, or  if it is empty.(vec <- fromFoldable @_ @_ @Int [1, 2, 3]assertM (== Just 3) (pop vec) assertM (== [1, 2]) (toList vec)+growable-vectorO(m).. Extend the vector with the elements of some  structure./vec <- fromFoldable @_ @_ @Char ['a', 'b', 'c']extend vec ['d', 'e', 'f']"assertM (== "abcdef") (toList vec),growable-vectorO(n),. Create a vector with the elements of some  structure.&vec <- fromFoldable @_ @_ @Int [1..10]!assertM (== [1..10]) (toList vec)-growable-vectorO(n)0. Create a list with the elements of the vector.vec <- new @_ @_ @Intextend vec [1..5] toList vec [1,2,3,4,5].growable-vectorO(n). Create a Primitive  copy of a vector./growable-vectorO(n). Create a Storable  copy of a vector.0growable-vectorO(n). Create a lifted  copy of a vector.1growable-vectorO(n). Create a Primitive  copy of a vector by applying a function to each element and its corresponding index.2growable-vectorO(n). Create a Storable  copy of a vector by applying a function to each element and its corresponding index.3growable-vectorO(n). Create a lifted  copy of a vector by applying a function to each element and its corresponding index.4growable-vectorO(n)5. Map over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10] map (+ 1) vec&assertM (== [2, 3 .. 11]) (toList vec)5growable-vectorO(n)>. Map strictly over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]map' (* 2) vec&assertM (== [2, 4 .. 20]) (toList vec)6growable-vectorO(n). Map over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)7growable-vectorO(n). Map strictly over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap' (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)growable-vectorcapacity "!#$%&'()*+,-03.1/24567 "!#$%&'()*+,-03.1/24567 Safe-Inferred }8growable-vectorIndexingThe 8 type allows access to values by (0-based) index. An example will be more explicit:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6]two <- unsafeRead vec 1unsafeWrite vec 1 7seven <- unsafeRead vec 1 two + seven9However, be careful: if you try to access an index which isn't in the 8, your program will exhibit undefined behaviour ("UB"), either returning garbage or segfaulting. You cannot do this:  v <- fromFoldable [0, 2, 4, 6] unsafeRead v 6 -- this is UB If you want safe access, use B:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6] read vec 1Just 2 read vec 6NothingCapacity and reallocationThe capacity of a vector is the amount of space allocated for any future elements that will be added onto the vector. This is not to be confused with the length of a vector, which specifies the number of actual elements within the vector. If a vector's length exceeds its capacity, its capacity will automatically be increased, but its elements will have to be reallocated.For example, a vector with capacity 10 and length 0 would be an empty vector with space for 10 more elements. Pushing 10 or fewer elements onto the vector will not change its capacity or cause reallocation to occur. However, if the vector's length is increased to 11, it will have to reallocate, which can be slow. For this reason, it is recommended to use : whenever possible to specify how big the vector is expected to get. Guarantees8 is a (pointer, capacity, length) triplet. The pointer will never be null.Because of the semantics of the GHC runtime, creating a new vector will always allocate. In particular, if you construct a -backed 8 with capacity 0 via 9 0, H [], or ? on an empty 8, the 16-byte header to GHC  'ByteArray#' will be allocated, but nothing else (for the curious: this is needed for 'sameMutableByteArray#' to work). Similarly, if you store zero-sized types inside such a 8', it will not allocate space for them. Note that in this case the 8 may not report a < of 0. 8 will allocate if and only if 'sizeOf (undefined :: a)  <  0.If a 8 has allocated memory, then the memory it points to is on the heap (as defined by GHC's allocator), and its pointer points to ; initialised, contiguous elements in order (i.e. what you would see if you turned it into a list), followed by <  ;. logically uninitialised, contiguous elements.8 will never automatically shrink itself, even if completely empty. This ensures no unnecessary allocations or deallocations occur. Emptying a 8) and then filling it back up to the same ; should incur no calls to the allocator. If you wish to free up unused memory, use ?.E will never (re)allocate if the reported capacity is sufficient. E will (re)allocate if ;  <. That is, the reported capacity is completely accurate, and can be relied on. Bulk insertion methods may% reallocate, even when not necessary.8 does not guarantee any particular growth strategy when reallocating when full, nor when > is called. The strategy is basic and may prove desirable to use a non-constant growth factor. Whatever strategy is used will of course guarantee O(1) amortised push.H and : will produce a 8% with exactly the requested capacity.8 will not specifically overwrite any data that is removed from it, but also won't specifically preserve it. Its uninitialised memory is scratch space that it may use however it wants. It will generally just do whatever is most efficient or otherwise easy to implement. Do not rely on removed data to be erased for security purposes. Even if a 8 drops out of scope, its buffer may simply be reused by another 8. Even if you zero a 8s memory first, this may not actually happen when you think it does because of Garbage Collection.9growable-vectorO(1). Constructs a new, empty 8 s a.vec <- new @_ @_ @IntassertM (== 0) (length vec)assertM (== 0) (capacity vec):growable-vectorO(1). Constructs a new, empty 8 arr s a.(The vector will be able to hold exactly capacity elements without reallocating. It is important to note that althrough the returned vector has the capacity, specified, with vector will have a zero length. !vec <- withCapacity @_ @_ @Int 10-- The vector contains no items, even though it has capacity for moreassertM (== 0) (length vec)assertM (== 10) (capacity vec)--- These are all done without reallocating... forM_ [1..10] $ \i -> push vec iassertM (== 10) (length vec)assertM (== 10) (capacity vec),-- ..but this may make the vector reallocate push vec 11assertM (== 11) (length vec)assertM (>= 11) (capacity vec);growable-vectorO(1)/. Returns the number of elements in the vector.<growable-vectorO(1). Returns the maximum number of elements the vector can hold without reallocating."vec <- withCapacity @_ @_ @Word 10 push vec 42assertM (== 10) (capacity vec)=growable-vectorO(n),. Reserves the minimum capacity for exactly  additional. more elements to be inserted in the given 8 s a. After calling =/, capacity will be greater than or equal to length + additional8. Does nothing if the capacity is already sufficient.?Capacity cannot be relied upon to be precisely minimal. Prefer >& if future insertions are expected.%vec <- fromFoldable @_ @_ @Int @_ [1]reserveExact vec 10assertM (>= 11) (capacity vec)>growable-vectorO(n)!. Reserves capacity for at least  additional. more elements to be inserted in the given 8 s a. The collection may reserve more space to avoid frequent reallocations. After calling >/, capacity will be greater than or equal to length + additional4. Does nothing if capacity is already sufficient.%vec <- fromFoldable @_ @_ @Int @_ [1]reserve vec 10assertM (>= 11) (capacity vec)?growable-vectorO(n)9. Shrinks the capacity of the vector as much as possible.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkToFit vecassertM (== 3) (capacity vec)@growable-vectorO(n)8. Shrinks the capacity of the vector with a lower bound.The capacity will remain at least as large as both the length and the supplied value.If the current capacity is less than the lower limit, this is a no-op.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkTo vec 4assertM (>= 4) (capacity vec)shrinkTo vec 0assertM (>= 3) (capacity vec)Agrowable-vectorO(1)+. Return the element at the given position.If the element index is out of bounds, this function will segfault.&The bounds are defined as [0, length).This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using B instead.Bgrowable-vectorO(1)/. Return the element at the given position, or " if the index is out of bounds.&The bounds are defined as [0, length).Cgrowable-vectorO(1)4. Write a value to the vector at the given position.;If the index is out of bounds, this function will segfault.The bounds are defined as [0, length). If you want to add an element past  length - 1, use E or G,, which can intelligently handle resizes.This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using D instead.Dgrowable-vectorO(1)4. Write a value to the vector at the given position.(If the index is in bounds, this returns  ()1. If the index is out of bounds, this returns .The bounds are defined as [0, length). If you want to add an element past  length - 1, use E or G,, which can intelligently handle resizes.Egrowable-vector Amortised O(1)#. Appends an element to the vector.%vec <- fromFoldable @_ @_ @Int [1, 2] push vec 3#assertM (== [1, 2, 3]) (toList vec)Fgrowable-vectorO(1)<. Removes the last element from a vector and returns it, or  if it is empty.(vec <- fromFoldable @_ @_ @Int [1, 2, 3]assertM (== Just 3) (pop vec) assertM (== [1, 2]) (toList vec)Ggrowable-vectorO(m).. Extend the vector with the elements of some  structure./vec <- fromFoldable @_ @_ @Char ['a', 'b', 'c']extend vec ['d', 'e', 'f']"assertM (== "abcdef") (toList vec)Hgrowable-vectorO(n),. Create a vector with the elements of some  structure.&vec <- fromFoldable @_ @_ @Int [1..10]!assertM (== [1..10]) (toList vec)Igrowable-vectorO(n)0. Create a list with the elements of the vector.vec <- new @_ @_ @Intextend vec [1..5] toList vec [1,2,3,4,5]Jgrowable-vectorO(n). Create a Primitive  copy of a vector.Kgrowable-vectorO(n). Create a Storable  copy of a vector.Lgrowable-vectorO(n). Create a lifted  copy of a vector.Mgrowable-vectorO(n). Create a Primitive  copy of a vector by applying a function to each element and its corresponding index.Ngrowable-vectorO(n). Create a Storable  copy of a vector by applying a function to each element and its corresponding index.Ogrowable-vectorO(n). Create a lifted  copy of a vector by applying a function to each element and its corresponding index.Pgrowable-vectorO(n)5. Map over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10] map (+ 1) vec&assertM (== [2, 3 .. 11]) (toList vec)Qgrowable-vectorO(n)>. Map strictly over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]map' (* 2) vec&assertM (== [2, 4 .. 20]) (toList vec)Rgrowable-vectorO(n). Map over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)Sgrowable-vectorO(n). Map strictly over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap' (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec):growable-vectorcapacity89:;<>=?@ABCDEFGHILOJMKNPQRS89:;<>=?@ABCDEFGHILOJMKNPQRS Safe-Inferred Tgrowable-vectorIndexingThe T type allows access to values by (0-based) index. An example will be more explicit:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6]two <- unsafeRead vec 1unsafeWrite vec 1 7seven <- unsafeRead vec 1 two + seven9However, be careful: if you try to access an index which isn't in the T, your program will exhibit undefined behaviour ("UB"), either returning garbage or segfaulting. You cannot do this:  v <- fromFoldable [0, 2, 4, 6] unsafeRead v 6 -- this is UB If you want safe access, use ^:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6] read vec 1Just 2 read vec 6NothingCapacity and reallocationThe capacity of a vector is the amount of space allocated for any future elements that will be added onto the vector. This is not to be confused with the length of a vector, which specifies the number of actual elements within the vector. If a vector's length exceeds its capacity, its capacity will automatically be increased, but its elements will have to be reallocated.For example, a vector with capacity 10 and length 0 would be an empty vector with space for 10 more elements. Pushing 10 or fewer elements onto the vector will not change its capacity or cause reallocation to occur. However, if the vector's length is increased to 11, it will have to reallocate, which can be slow. For this reason, it is recommended to use V whenever possible to specify how big the vector is expected to get. GuaranteesT is a (pointer, capacity, length) triplet. The pointer will never be null.Because of the semantics of the GHC runtime, creating a new vector will always allocate. In particular, if you construct a -backed T with capacity 0 via U 0, d [], or [ on an empty T, the 16-byte header to GHC  'ByteArray#' will be allocated, but nothing else (for the curious: this is needed for 'sameMutableByteArray#' to work). Similarly, if you store zero-sized types inside such a T', it will not allocate space for them. Note that in this case the T may not report a X of 0. T will allocate if and only if 'sizeOf (undefined :: a)  X  0.If a T has allocated memory, then the memory it points to is on the heap (as defined by GHC's allocator), and its pointer points to W initialised, contiguous elements in order (i.e. what you would see if you turned it into a list), followed by X  W. logically uninitialised, contiguous elements.T will never automatically shrink itself, even if completely empty. This ensures no unnecessary allocations or deallocations occur. Emptying a T) and then filling it back up to the same W should incur no calls to the allocator. If you wish to free up unused memory, use [.a will never (re)allocate if the reported capacity is sufficient. a will (re)allocate if W  X. That is, the reported capacity is completely accurate, and can be relied on. Bulk insertion methods may% reallocate, even when not necessary.T does not guarantee any particular growth strategy when reallocating when full, nor when Z is called. The strategy is basic and may prove desirable to use a non-constant growth factor. Whatever strategy is used will of course guarantee O(1) amortised push.d and V will produce a T% with exactly the requested capacity.T will not specifically overwrite any data that is removed from it, but also won't specifically preserve it. Its uninitialised memory is scratch space that it may use however it wants. It will generally just do whatever is most efficient or otherwise easy to implement. Do not rely on removed data to be erased for security purposes. Even if a T drops out of scope, its buffer may simply be reused by another T. Even if you zero a Ts memory first, this may not actually happen when you think it does because of Garbage Collection.Ugrowable-vectorO(1). Constructs a new, empty T s a.vec <- new @_ @_ @IntassertM (== 0) (length vec)assertM (== 0) (capacity vec)Vgrowable-vectorO(1). Constructs a new, empty T arr s a.(The vector will be able to hold exactly capacity elements without reallocating. It is important to note that althrough the returned vector has the capacity, specified, with vector will have a zero length. !vec <- withCapacity @_ @_ @Int 10-- The vector contains no items, even though it has capacity for moreassertM (== 0) (length vec)assertM (== 10) (capacity vec)--- These are all done without reallocating... forM_ [1..10] $ \i -> push vec iassertM (== 10) (length vec)assertM (== 10) (capacity vec),-- ..but this may make the vector reallocate push vec 11assertM (== 11) (length vec)assertM (>= 11) (capacity vec)Wgrowable-vectorO(1)/. Returns the number of elements in the vector.Xgrowable-vectorO(1). Returns the maximum number of elements the vector can hold without reallocating."vec <- withCapacity @_ @_ @Word 10 push vec 42assertM (== 10) (capacity vec)Ygrowable-vectorO(n),. Reserves the minimum capacity for exactly  additional. more elements to be inserted in the given T s a. After calling Y/, capacity will be greater than or equal to length + additional8. Does nothing if the capacity is already sufficient.?Capacity cannot be relied upon to be precisely minimal. Prefer Z& if future insertions are expected.%vec <- fromFoldable @_ @_ @Int @_ [1]reserveExact vec 10assertM (>= 11) (capacity vec)Zgrowable-vectorO(n)!. Reserves capacity for at least  additional. more elements to be inserted in the given T s a. The collection may reserve more space to avoid frequent reallocations. After calling Z/, capacity will be greater than or equal to length + additional4. Does nothing if capacity is already sufficient.%vec <- fromFoldable @_ @_ @Int @_ [1]reserve vec 10assertM (>= 11) (capacity vec)[growable-vectorO(n)9. Shrinks the capacity of the vector as much as possible.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkToFit vecassertM (== 3) (capacity vec)\growable-vectorO(n)8. Shrinks the capacity of the vector with a lower bound.The capacity will remain at least as large as both the length and the supplied value.If the current capacity is less than the lower limit, this is a no-op.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkTo vec 4assertM (>= 4) (capacity vec)shrinkTo vec 0assertM (>= 3) (capacity vec)]growable-vectorO(1)+. Return the element at the given position.If the element index is out of bounds, this function will segfault.&The bounds are defined as [0, length).This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using ^ instead.^growable-vectorO(1)/. Return the element at the given position, or " if the index is out of bounds.&The bounds are defined as [0, length)._growable-vectorO(1)4. Write a value to the vector at the given position.;If the index is out of bounds, this function will segfault.The bounds are defined as [0, length). If you want to add an element past  length - 1, use a or c,, which can intelligently handle resizes.This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using ` instead.`growable-vectorO(1)4. Write a value to the vector at the given position.(If the index is in bounds, this returns  ()1. If the index is out of bounds, this returns .The bounds are defined as [0, length). If you want to add an element past  length - 1, use a or c,, which can intelligently handle resizes.agrowable-vector Amortised O(1)#. Appends an element to the vector.%vec <- fromFoldable @_ @_ @Int [1, 2] push vec 3#assertM (== [1, 2, 3]) (toList vec)bgrowable-vectorO(1)<. Removes the last element from a vector and returns it, or  if it is empty.(vec <- fromFoldable @_ @_ @Int [1, 2, 3]assertM (== Just 3) (pop vec) assertM (== [1, 2]) (toList vec)cgrowable-vectorO(m).. Extend the vector with the elements of some  structure./vec <- fromFoldable @_ @_ @Char ['a', 'b', 'c']extend vec ['d', 'e', 'f']"assertM (== "abcdef") (toList vec)dgrowable-vectorO(n),. Create a vector with the elements of some  structure.&vec <- fromFoldable @_ @_ @Int [1..10]!assertM (== [1..10]) (toList vec)egrowable-vectorO(n)0. Create a list with the elements of the vector.vec <- new @_ @_ @Intextend vec [1..5] toList vec [1,2,3,4,5]fgrowable-vectorO(n). Create a Primitive  copy of a vector.ggrowable-vectorO(n). Create a Storable  copy of a vector.hgrowable-vectorO(n). Create a lifted  copy of a vector.igrowable-vectorO(n). Create a Primitive  copy of a vector by applying a function to each element and its corresponding index.jgrowable-vectorO(n). Create a Storable  copy of a vector by applying a function to each element and its corresponding index.kgrowable-vectorO(n). Create a lifted  copy of a vector by applying a function to each element and its corresponding index.lgrowable-vectorO(n)5. Map over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10] map (+ 1) vec&assertM (== [2, 3 .. 11]) (toList vec)mgrowable-vectorO(n)>. Map strictly over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]map' (* 2) vec&assertM (== [2, 4 .. 20]) (toList vec)ngrowable-vectorO(n). Map over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)ogrowable-vectorO(n). Map strictly over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap' (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)Vgrowable-vectorcapacityTUVWXZY[\]^_`abcdehkfigjlmnoTUVWXZY[\]^_`abcdehkfigjlmno Safe-Inferred pgrowable-vectorIndexingThe p type allows access to values by (0-based) index. An example will be more explicit:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6]two <- unsafeRead vec 1unsafeWrite vec 1 7seven <- unsafeRead vec 1 two + seven9However, be careful: if you try to access an index which isn't in the p, your program will exhibit undefined behaviour ("UB"), either returning garbage or segfaulting. You cannot do this:  v <- fromFoldable [0, 2, 4, 6] unsafeRead v 6 -- this is UB If you want safe access, use z:+vec <- fromFoldable @_ @_ @Int [0, 2, 4, 6] read vec 1Just 2 read vec 6NothingCapacity and reallocationThe capacity of a vector is the amount of space allocated for any future elements that will be added onto the vector. This is not to be confused with the length of a vector, which specifies the number of actual elements within the vector. If a vector's length exceeds its capacity, its capacity will automatically be increased, but its elements will have to be reallocated.For example, a vector with capacity 10 and length 0 would be an empty vector with space for 10 more elements. Pushing 10 or fewer elements onto the vector will not change its capacity or cause reallocation to occur. However, if the vector's length is increased to 11, it will have to reallocate, which can be slow. For this reason, it is recommended to use r whenever possible to specify how big the vector is expected to get. Guaranteesp is a (pointer, capacity, length) triplet. The pointer will never be null.Because of the semantics of the GHC runtime, creating a new vector will always allocate. In particular, if you construct a -backed p with capacity 0 via q 0,  [], or w on an empty p, the 16-byte header to GHC  'ByteArray#' will be allocated, but nothing else (for the curious: this is needed for 'sameMutableByteArray#' to work). Similarly, if you store zero-sized types inside such a p', it will not allocate space for them. Note that in this case the p may not report a t of 0. p will allocate if and only if 'sizeOf (undefined :: a)  t  0.If a p has allocated memory, then the memory it points to is on the heap (as defined by GHC's allocator), and its pointer points to s initialised, contiguous elements in order (i.e. what you would see if you turned it into a list), followed by t  s. logically uninitialised, contiguous elements.p will never automatically shrink itself, even if completely empty. This ensures no unnecessary allocations or deallocations occur. Emptying a p) and then filling it back up to the same s should incur no calls to the allocator. If you wish to free up unused memory, use w.} will never (re)allocate if the reported capacity is sufficient. } will (re)allocate if s  t. That is, the reported capacity is completely accurate, and can be relied on. Bulk insertion methods may% reallocate, even when not necessary.p does not guarantee any particular growth strategy when reallocating when full, nor when v is called. The strategy is basic and may prove desirable to use a non-constant growth factor. Whatever strategy is used will of course guarantee O(1) amortised push. and r will produce a p% with exactly the requested capacity.p will not specifically overwrite any data that is removed from it, but also won't specifically preserve it. Its uninitialised memory is scratch space that it may use however it wants. It will generally just do whatever is most efficient or otherwise easy to implement. Do not rely on removed data to be erased for security purposes. Even if a p drops out of scope, its buffer may simply be reused by another p. Even if you zero a ps memory first, this may not actually happen when you think it does because of Garbage Collection.qgrowable-vectorO(1). Constructs a new, empty p s a.vec <- new @_ @_ @IntassertM (== 0) (length vec)assertM (== 0) (capacity vec)rgrowable-vectorO(1). Constructs a new, empty p arr s a.(The vector will be able to hold exactly capacity elements without reallocating. It is important to note that althrough the returned vector has the capacity, specified, with vector will have a zero length. !vec <- withCapacity @_ @_ @Int 10-- The vector contains no items, even though it has capacity for moreassertM (== 0) (length vec)assertM (== 10) (capacity vec)--- These are all done without reallocating... forM_ [1..10] $ \i -> push vec iassertM (== 10) (length vec)assertM (== 10) (capacity vec),-- ..but this may make the vector reallocate push vec 11assertM (== 11) (length vec)assertM (>= 11) (capacity vec)sgrowable-vectorO(1)/. Returns the number of elements in the vector.tgrowable-vectorO(1). Returns the maximum number of elements the vector can hold without reallocating."vec <- withCapacity @_ @_ @Word 10 push vec 42assertM (== 10) (capacity vec)ugrowable-vectorO(n),. Reserves the minimum capacity for exactly  additional. more elements to be inserted in the given p s a. After calling u/, capacity will be greater than or equal to length + additional8. Does nothing if the capacity is already sufficient.?Capacity cannot be relied upon to be precisely minimal. Prefer v& if future insertions are expected.%vec <- fromFoldable @_ @_ @Int @_ [1]reserveExact vec 10assertM (>= 11) (capacity vec)vgrowable-vectorO(n)!. Reserves capacity for at least  additional. more elements to be inserted in the given p s a. The collection may reserve more space to avoid frequent reallocations. After calling v/, capacity will be greater than or equal to length + additional4. Does nothing if capacity is already sufficient.%vec <- fromFoldable @_ @_ @Int @_ [1]reserve vec 10assertM (>= 11) (capacity vec)wgrowable-vectorO(n)9. Shrinks the capacity of the vector as much as possible.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkToFit vecassertM (== 3) (capacity vec)xgrowable-vectorO(n)8. Shrinks the capacity of the vector with a lower bound.The capacity will remain at least as large as both the length and the supplied value.If the current capacity is less than the lower limit, this is a no-op.!vec <- withCapacity @_ @_ @Int 10extend vec [1, 2, 3]assertM (== 10) (capacity vec)shrinkTo vec 4assertM (>= 4) (capacity vec)shrinkTo vec 0assertM (>= 3) (capacity vec)ygrowable-vectorO(1)+. Return the element at the given position.If the element index is out of bounds, this function will segfault.&The bounds are defined as [0, length).This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using z instead.zgrowable-vectorO(1)/. Return the element at the given position, or " if the index is out of bounds.&The bounds are defined as [0, length).{growable-vectorO(1)4. Write a value to the vector at the given position.;If the index is out of bounds, this function will segfault.The bounds are defined as [0, length). If you want to add an element past  length - 1, use } or ,, which can intelligently handle resizes.This function is intended to be used in situations where you have manually proved that your indices are within bounds, and you don't want to repeatedly pay for bounds checking.Consider using | instead.|growable-vectorO(1)4. Write a value to the vector at the given position.(If the index is in bounds, this returns  ()1. If the index is out of bounds, this returns .The bounds are defined as [0, length). If you want to add an element past  length - 1, use } or ,, which can intelligently handle resizes.}growable-vector Amortised O(1)#. Appends an element to the vector.%vec <- fromFoldable @_ @_ @Int [1, 2] push vec 3#assertM (== [1, 2, 3]) (toList vec)~growable-vectorO(1)<. Removes the last element from a vector and returns it, or  if it is empty.(vec <- fromFoldable @_ @_ @Int [1, 2, 3]assertM (== Just 3) (pop vec) assertM (== [1, 2]) (toList vec)growable-vectorO(m).. Extend the vector with the elements of some  structure./vec <- fromFoldable @_ @_ @Char ['a', 'b', 'c']extend vec ['d', 'e', 'f']"assertM (== "abcdef") (toList vec)growable-vectorO(n),. Create a vector with the elements of some  structure.&vec <- fromFoldable @_ @_ @Int [1..10]!assertM (== [1..10]) (toList vec)growable-vectorO(n)0. Create a list with the elements of the vector.vec <- new @_ @_ @Intextend vec [1..5] toList vec [1,2,3,4,5]growable-vectorO(n). Create a Primitive  copy of a vector.growable-vectorO(n). Create a Storable  copy of a vector.growable-vectorO(n). Create a lifted  copy of a vector.growable-vectorO(n). Create a Primitive  copy of a vector by applying a function to each element and its corresponding index.growable-vectorO(n). Create a Storable  copy of a vector by applying a function to each element and its corresponding index.growable-vectorO(n). Create a lifted  copy of a vector by applying a function to each element and its corresponding index.growable-vectorO(n)5. Map over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10] map (+ 1) vec&assertM (== [2, 3 .. 11]) (toList vec)growable-vectorO(n)>. Map strictly over an array, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]map' (* 2) vec&assertM (== [2, 4 .. 20]) (toList vec)growable-vectorO(n). Map over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)growable-vectorO(n). Map strictly over an array with a function that takes the index and its corresponding element as input, modifying the elements in place.&vec <- fromFoldable @_ @_ @Int [1..10]imap' (\ix el -> ix + 1) vec3assertM (== zipWith (+) [0..] [1..10]) (toList vec)rgrowable-vectorcapacitypqrstvuwxyz{|}~pqrstvuwxyz{|}~      !"#$      !"#$      !"#$      !"#$      !"#$%&'()*+,-(./+,0(.1+23+24+567897:97;9%<=>growable-vector-0.1-inplaceGrowableVectorGrowableVector.LiftedGrowableVector.Lifted.SmallGrowableVector.UnboxedGrowableVector.Unliftedgrowable-vectorGHC.ExtssameMutableByteArray#Vecnew withCapacitylengthcapacity reserveExactreserve shrinkToFitshrinkTo unsafeReadread unsafeWritewritepushpopextend fromFoldabletoListtoPrimitiveVectortoStorableVectortoLiftedVectortoPrimitiveVectorWithtoStorableVectorWithtoLiftedVectorWithmapmap'imapimap'primitive-0.8.0.0-9e329dec5bf7948786535862e6b690e48a4b0f924ed354cca01f1d14175dc683Data.Primitive.PrimArrayMutablePrimArrayghc-primGHC.Prim ByteArray#baseGHC.Num* GHC.Classes>-== GHC.MaybeNothingJust Data.FoldableFoldablevector-0.13.0.0-3e0e39400456a59217cf4a5fed009425dbef46d9ad41246aac074165233ec9ebData.Vector.PrimitiveVectorData.Vector.Storable Data.VectorData.Primitive.Array MutableArray