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

CopyrightEdward Kmett 2011-2015 Johan Tibell 2011
LicenseBSD3
Maintainerekmett@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

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 a Source

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

index :: Array a -> Int -> a Source

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

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

update :: Array e -> Int -> e -> Array e Source

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

insert :: Array e -> Int -> e -> Array e Source

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

delete :: Array e -> Int -> Array e Source

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 e Source

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 -> b Source

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

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

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

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

Strict version of map.

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

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