safe-freeze-0.0: Support for safely freezing multiple arrays in the ST monad.Source codeContentsIndex
Data.Array.Vector.STFreeze
Portabilityportable
Stabilityexperimental
MaintainerReiner Pope <reiner.pope@gmail.com>
Contents
Array classes
Streaming pure arrays
Conversions to/from lists
Basic operations on pure arrays
Introducing and eliminating UArrs
Basic interface
Transforming UArrs
Reducing UArrs (folds)
Logical operations
Arithmetic operations
Building UArrs
Scans
Accumulating UArrs
Generating UArrs
Unfolding UArrs
Subarrays
Breaking arrays
Searching Arrays
Searching by equality
Searching with a predicate
Indexing UArrs
Zipping and unzipping
Enumerations
I/O
Operations on mutable arrays
Description

Support for using uvector's MUArrs in the new ST monad. Reexports all of Data.Array.Vector's API, but all the ST operations are done with the new ST monad.

Notable differences in API:

  • the former unsafeFreezeMU is in fact safe, and is now named freezeMU.
  • similarly for unsafeFreezeAllMU
  • newU is no longer required as a primitive; it can be implemented using runSTT and freezeAllMU, mentioning no unsafe operations.

Example demonstration of using the new ST monad:

foo :: (UArr Int, UArr Int)
foo = runST go where
  go :: forall s. ST (Normal s) (Freeze s) (UArr Int, UArr Int)
  go = newMU 5 >>>= a1 ->
       newMU 6 >>>= a2 ->
       writeMU a1 0 3 >>>= () ->
       writeMU a2 1 2 >>>= () ->
       freezeAllMU a1 >>>= v1 ->
       freezeAllMU a2 >>>= v2 ->
       return (v1,v2)
Synopsis
UA (UArr, MUArr, lengthU, indexU, sliceU, lengthMU, newMU, readMU, writeMU, copyMU, unsafeFreezeMU, memcpyMU, memcpyOffMU, memmoveOffMU)
UArr
MUArr
streamU
unstreamU
toU
fromU
emptyU
singletonU
consU
snocU
appendU
headU
lastU
tailU
initU
nullU
unitsU
lengthU
mapU
foldU
fold1U
fold1MaybeU
foldlU
foldl1U
foldl1MaybeU
andU
orU
anyU
allU
sumU
productU
maximumU
minimumU
maximumByU
minimumByU
scanlU
scanl1U
scanU
scan1U
scanResU
mapAccumLU
iterateU
replicateU
replicateEachU
unfoldU
sliceU
takeU
dropU
splitAtU
takeWhileU
dropWhileU
elemU
notElemU
filterU
findU
findIndexU
indexU
lookupU
zipU
zip3U
unzipU
unzip3U
zipWithU
zipWith3U
fstU
sndU
enumFromToU
enumFromToFracU
enumFromThenToU
enumFromStepLenU
enumFromToEachU
combineU
packU
indexedU
repeatU
UIO (hPutU, hGetU)
lengthMU
newMU :: (UA e, MonadST st) => Int -> STNormal st s (MUArr e s)
readMU :: (UA e, MonadST st) => MUArr e s -> Int -> STRead st s e
writeMU :: (UA e, MonadST st) => MUArr e s -> Int -> e -> STNormal st s ()
freezeMU :: (UA e, MonadST st) => MUArr e s -> Int -> STFreeze st s (UArr e)
freezeAllMU :: (UA e, MonadST st) => MUArr e s -> STFreeze st s (UArr e)
copyMU :: (UA e, MonadST st) => MUArr e s -> Int -> UArr e -> STNormal st s ()
permuteMU :: (UA e, MonadST st) => MUArr e s -> UArr e -> UArr Int -> STNormal st s ()
atomicUpdateMU :: (UA e, MonadST st) => MUArr e s -> UArr (Int :*: e) -> STNormal st s ()
unstreamMU
memcpyMU :: (UA e, MonadST st) => MUArr e s -> MUArr e s -> Int -> STNormal st s ()
memcpyOffMU :: (UA e, MonadST st) => MUArr e s -> MUArr e s -> Int -> Int -> Int -> STNormal st s ()
memmoveOffMU :: (UA e, MonadST st) => MUArr e s -> MUArr e s -> Int -> Int -> Int -> STNormal st s ()
unsafeZipMU
unsafeUnzipMU
Array classes
UA (UArr, MUArr, lengthU, indexU, sliceU, lengthMU, newMU, readMU, writeMU, copyMU, unsafeFreezeMU, memcpyMU, memcpyOffMU, memmoveOffMU)
UArr
MUArr
Streaming pure arrays
streamU
unstreamU
Conversions to/from lists
toU
fromU
Basic operations on pure arrays
Introducing and eliminating UArrs
emptyU
singletonU
Basic interface
consU
snocU
appendU
headU
lastU
tailU
initU
nullU
unitsU
lengthU
Transforming UArrs
mapU
Reducing UArrs (folds)
foldU
fold1U
fold1MaybeU
foldlU
foldl1U
foldl1MaybeU
Logical operations
andU
orU
anyU
allU
Arithmetic operations
sumU
productU
maximumU
minimumU
maximumByU
minimumByU
Building UArrs
Scans
scanlU
scanl1U
scanU
scan1U
scanResU
Accumulating UArrs
mapAccumLU
Generating UArrs
iterateU
replicateU
replicateEachU
Unfolding UArrs
unfoldU
Subarrays
Breaking arrays
sliceU
takeU
dropU
splitAtU
takeWhileU
dropWhileU
Searching Arrays
Searching by equality
elemU
notElemU
Searching with a predicate
filterU
findU
findIndexU
Indexing UArrs
indexU
lookupU
Zipping and unzipping
zipU
zip3U
unzipU
unzip3U
zipWithU
zipWith3U
fstU
sndU
Enumerations
enumFromToU
enumFromToFracU
enumFromThenToU
enumFromStepLenU
enumFromToEachU
combineU
packU
indexedU
repeatU
I/O
UIO (hPutU, hGetU)
Operations on mutable arrays
lengthMU
newMU :: (UA e, MonadST st) => Int -> STNormal st s (MUArr e s)Source
readMU :: (UA e, MonadST st) => MUArr e s -> Int -> STRead st s eSource
writeMU :: (UA e, MonadST st) => MUArr e s -> Int -> e -> STNormal st s ()Source
freezeMU :: (UA e, MonadST st) => MUArr e s -> Int -> STFreeze st s (UArr e)Source
freezeAllMU :: (UA e, MonadST st) => MUArr e s -> STFreeze st s (UArr e)Source
copyMU :: (UA e, MonadST st) => MUArr e s -> Int -> UArr e -> STNormal st s ()Source
permuteMU :: (UA e, MonadST st) => MUArr e s -> UArr e -> UArr Int -> STNormal st s ()Source
atomicUpdateMU :: (UA e, MonadST st) => MUArr e s -> UArr (Int :*: e) -> STNormal st s ()Source
unstreamMU
memcpyMU :: (UA e, MonadST st) => MUArr e s -> MUArr e s -> Int -> STNormal st s ()Source
memcpyOffMU :: (UA e, MonadST st) => MUArr e s -> MUArr e s -> Int -> Int -> Int -> STNormal st s ()Source
memmoveOffMU :: (UA e, MonadST st) => MUArr e s -> MUArr e s -> Int -> Int -> Int -> STNormal st s ()Source
unsafeZipMU
unsafeUnzipMU
Produced by Haddock version 2.4.2