Copyright | Copyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Tested with: GHC 7.8.3
It defines a prototype of mutable unboxed vectors.
- data Vector m a
- newVector :: ProtoArrayMonad m a => Session m -> m (Vector m a)
- copyVector :: ProtoArrayMonad m a => Vector m a -> m (Vector m a)
- vectorCount :: ProtoArrayMonad m a => Vector m a -> m Int
- appendVector :: ProtoArrayMonad m a => Vector m a -> a -> m ()
- readVector :: ProtoArrayMonad m a => Vector m a -> Int -> m a
- writeVector :: ProtoArrayMonad m a => Vector m a -> Int -> a -> m ()
- vectorBinarySearch :: (ProtoArrayMonad m a, Ord a) => Vector m a -> a -> m Int
- vectorInsert :: ProtoArrayMonad m a => Vector m a -> Int -> a -> m ()
- vectorDeleteAt :: ProtoArrayMonad m a => Vector m a -> Int -> m ()
- vectorIndex :: (ProtoArrayMonad m a, Eq a) => Vector m a -> a -> m Int
- freezeVector :: ProtoArrayMonad m a => Vector m a -> m (Array Int a)
Documentation
newVector :: ProtoArrayMonad m a => Session m -> m (Vector m a) Source
Create a new vector within the specified simulation session.
copyVector :: ProtoArrayMonad m a => Vector m a -> m (Vector m a) Source
Copy the vector.
vectorCount :: ProtoArrayMonad m a => Vector m a -> m Int Source
Return the element count.
appendVector :: ProtoArrayMonad m a => Vector m a -> a -> m () Source
Add the specified element to the end of the vector.
readVector :: ProtoArrayMonad m a => Vector m a -> Int -> m a Source
Read a value from the vector, where indices are started from 0.
writeVector :: ProtoArrayMonad m a => Vector m a -> Int -> a -> m () Source
Set an array item at the specified index which is started from 0.
vectorBinarySearch :: (ProtoArrayMonad m a, Ord a) => Vector m a -> a -> m Int Source
Return the index of the specified element using binary search; otherwise, a negated insertion index minus one: 0 -> -0 - 1, ..., i -> -i - 1, ....
vectorInsert :: ProtoArrayMonad m a => Vector m a -> Int -> a -> m () Source
Insert the element in the vector at the specified index.
vectorDeleteAt :: ProtoArrayMonad m a => Vector m a -> Int -> m () Source
Delete the element at the specified index.
vectorIndex :: (ProtoArrayMonad m a, Eq a) => Vector m a -> a -> m Int Source
Return the index of the item or -1.
freezeVector :: ProtoArrayMonad m a => Vector m a -> m (Array Int a) Source
Return the elements of the vector in an immutable array.