ghc-boot-10.0.0.20260917: Shared functionality between GHC and its boot libraries
Safe HaskellNone
LanguageGHC2024

GHC.Data.SmallArray

Description

Small-array

Synopsis

Documentation

data SmallArray a Source #

Constructors

SmallArray (SmallArray# a) 

Instances

Instances details
Binary a => Binary (SmallArray a) Source # 
Instance details

Defined in GHC.Data.SmallArray

Show a => Show (SmallArray a) Source # 
Instance details

Defined in GHC.Data.SmallArray

newSmallArray Source #

Arguments

:: Int

size

-> a

initial contents

-> State# s 
-> (# State# s, SmallMutableArray s a #) 

writeSmallArray Source #

Arguments

:: SmallMutableArray s a

array

-> Int

index

-> a

new element

-> State# s 
-> State# s 

freezeSmallArray Source #

Arguments

:: SmallMutableArray s a

source

-> Int

offset

-> Int

length

-> State# s 
-> (# State# s, SmallArray a #) 

Copy and freeze a slice of a mutable array.

unsafeFreezeSmallArray :: SmallMutableArray s a -> State# s -> (# State# s, SmallArray a #) Source #

Freeze a mutable array (no copy!)

indexSmallArray Source #

Arguments

:: SmallArray a

array

-> Int

index

-> a 

Index a small-array (no bounds checking!)

listToArray :: Int -> (e -> Int) -> (e -> a) -> [e] -> SmallArray a Source #

Convert a list into an array.

smallArrayFromList :: [a] -> SmallArray a Source #

Construct a SmallArray from a list. This is different from listToArray since the list elements fill the SmallArray sequentially without recalculating the indices or remapping to other element types.

smallArrayToList :: SmallArray a -> [a] Source #

Construct a list from a SmallArray.

mapSmallArray :: (a -> b) -> SmallArray a -> SmallArray b Source #

Map a function over the elements of a SmallArray

foldMapSmallArray :: Monoid m => (a -> m) -> SmallArray a -> m Source #

Fold the values of a SmallArray into a 'Monoid m' of choice

replicateSmallArrayIO :: Int -> IO a -> IO (SmallArray a) Source #

Execute the IO action the given number of times and store the results in a SmallArray.

mapSmallArrayIO :: (a -> IO b) -> SmallArray a -> IO (SmallArray b) Source #

Apply the IO action to every element, producing a new SmallArray.

mapSmallArrayM_ :: Applicative f => (a -> f b) -> SmallArray a -> f () Source #

Apply the monadic action to every element, ignoring the results.

imapSmallArrayM_ :: Applicative f => (Int -> a -> f b) -> SmallArray a -> f () Source #

Apply the monadic action to every element and its index, ignoring the results.

rnfSmallArray :: NFData a => SmallArray a -> () Source #

Force the elements of the given SmallArray

IO Operations