trifecta-0.50.2.1: A modern parser combinator library with convenient diagnostics

Portabilityunknown
Stabilityexperimental
Maintainerekmett@gmail.com
Safe HaskellSafe-Infered

Text.Trifecta.Util.Array

Contents

Description

Fast zero based arrays, based on the implementation in the HAMT-branch of unordered-containers

Synopsis

Documentation

data Array a Source

Instances

NFData a => NFData (Array a) 

data MArray s a Source

Creation

new :: Int -> a -> ST s (MArray s a)Source

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

new_ :: Int -> ST s (MArray s a)Source

Basic interface

read :: MArray s a -> Int -> ST s aSource

write :: MArray s a -> Int -> a -> ST s ()Source

index :: Array a -> Int -> aSource

index_ :: Array a -> Int -> ST s aSource

indexM_ :: MArray s a -> Int -> ST s aSource

update :: Array e -> Int -> e -> Array eSource

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

insert :: Array e -> Int -> e -> Array eSource

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

delete :: Array e -> Int -> Array eSource

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

run :: (forall s. ST s (MArray s e)) -> Array eSource

run2 :: (forall s. ST s (MArray s e, a)) -> (Array e, a)Source

copy :: Array e -> Int -> MArray s e -> Int -> Int -> ST s ()Source

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

copyM :: MArray s e -> Int -> MArray s e -> Int -> Int -> ST s ()Source

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

Folds

foldl' :: (b -> a -> b) -> b -> Array a -> bSource

foldr :: (a -> b -> b) -> b -> Array a -> bSource

thaw :: Array e -> Int -> Int -> ST s (MArray s e)Source

map :: (a -> b) -> Array a -> Array bSource

map' :: (a -> b) -> Array a -> Array bSource

Strict version of map.

traverse :: Applicative f => (a -> f b) -> Array a -> f (Array b)Source

filter :: (a -> Bool) -> Array a -> Array aSource