HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

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.

Contents
  1. Creation
  2. Basic interface
  3. Folds
Synopsis
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

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

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.

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.

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.

Folds

valueall :: (a -> Bool) -> Array a -> Bool

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