HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleunordered-containers-0.2.21Haskell2010

Data.HashMap.Internal.Array

WARNING

This module is considered internal.

The Package Versioning Policy does not apply.

The contents of this module may change in any way whatsoever and without any warning between minor versions of this package.

Authors importing this module are expected to track development closely.

Description

Zero based arrays.

Note that no bounds checking are performed.

  • 2 types
  • 43 values
datadata Array a
#

Constructors

Instances4NFData1, Lift, Show, NFData
  • NFData1 ArrayDefined in unordered-containers-0.2.21 · Data.HashMap.Internal.Array
  • Lift a => Lift (Array a)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.Array
  • Show a => Show (Array a)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.Array
  • NFData a => NFData (Array a)Defined in unordered-containers-0.2.21 · Data.HashMap.Internal.Array

Creation

6 declarations
valuenew :: Int -> a -> ST s (MArray s a)
#

Create a new mutable array of specified size, in the specified state thread, with each element containing the specified initial value.

Basic interface

20 declarations
valueindex# :: Array a -> Int -> (# a #)
#

Note that we don't have an index function with type

Array a -> Int -> a

We used to have it, but it was prone to creating thunks. See #538.

valueupdate :: Array e -> Int -> e -> Array e
#

O(n) Update the element at the given position in this array.

valueupdateWith' :: Array e -> Int -> (e -> e) -> Array e
#

O(n) Update the element at the given position in this array, by applying a function to it. Evaluates the element to WHNF before inserting it into the array.

valueunsafeUpdateM :: Array e -> Int -> e -> ST s ()
#

O(1) Update the element at the given position in this array, without copying.

valueinsert :: Array e -> Int -> e -> Array e
#

O(n) Insert an element at the given position in this array, increasing its size by one.

valueinsertM :: Array e -> Int -> e -> ST s (Array e)
#

O(n) Insert an element at the given position in this array, increasing its size by one.

valuedelete :: Array e -> Int -> Array e
#

O(n) Delete an element at the given position in this array, decreasing its size by one.

valuecopy :: Array e -> Int -> MArray s e -> Int -> Int -> ST s ()
#

Unsafely copy the elements of an array. Array bounds are not checked.

valuecopyM :: MArray s e -> Int -> MArray s e -> Int -> Int -> ST s ()
#

Unsafely copy the elements of an array. Array bounds are not checked.

Folds

17 declarations
valueall :: (a -> Bool) -> Array a -> Bool
#

Verifies that a predicate holds for all elements of an array.

valueshrink :: MArray s a -> Int -> ST s (MArray s a)
#

The returned array is the same as the array given, as it is shrunk in place.