Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Abstraction Layer for Mutable Vectors
- class VecFamily v a | v -> a where
- type UVector a = IOVector a
- newtype Vec a = Vec (UVector a)
- class SingleStorage s t | s -> t where
- type Bool' = IOVector Bool
- type Double' = IOVector Double
- type Int' = IOVector Int
- class SingleStorage s Int => StackFamily s t | s -> t where
- type Stack = Vec Int
- newStackFromList :: [Int] -> IO Stack
Vector class
class VecFamily v a | v -> a where Source #
Interface on vectors.
getNth :: v -> Int -> IO a Source #
returns the n-th value.
setNth :: v -> Int -> a -> IO () Source #
sets the n-th value.
erases all elements in it.
asUVector :: a ~ Int => v -> UVector Int Source #
converts to an Int vector.
swapBetween :: v -> Int -> Int -> IO () Source #
returns the n-th value (index starts from zero in any case). | swaps two elements.
modifyNth :: v -> (a -> a) -> Int -> IO () Source #
calls the update function.
newVec :: Int -> a -> IO v Source #
returns a new vector.
setAll :: v -> a -> IO () Source #
sets all elements.
growBy :: v -> Int -> IO v Source #
extends the size of stack by n; note: values in new elements aren't initialized maybe.
asList :: v -> IO [a] Source #
converts to a list.
VecFamily ClauseVector Clause Source # |
|
VecFamily Clause Lit Source # | |
VecFamily WatcherList Clause Source # |
|
VecFamily ClauseExtManager Clause Source # |
|
VecFamily (Vec Double) Double Source # | |
VecFamily (Vec Int) Int Source # | |
VecFamily (UVector Double) Double Source # | |
VecFamily (UVector Int) Int Source # | |
Vectors
Another abstraction layer on UVector
.
Note: the 0-th element of Vec Int
is reserved for internal tasks. If you want to use it, use UVector Int
.
SingleStorage
class SingleStorage s t | s -> t where Source #
Interface for single mutable data
allocates and returns an new data.
gets the value.
set' :: s -> t -> IO () Source #
sets the value.
modify' :: s -> (t -> t) -> IO () Source #
calls an update function on it.
SingleStorage Stack Int Source # | |
SingleStorage Double' Double Source # | |
SingleStorage Bool' Bool Source # | |
SingleStorage Int' Int Source # | |
SingleStorage Clause Int Source # |
|
SingleStorage ClauseExtManager Int Source # |
|
Stack
class SingleStorage s Int => StackFamily s t | s -> t where Source #
Interface on stacks
newStack :: Int -> IO s Source #
returns a new stack.
pushTo :: s -> t -> IO () Source #
pushs an value to the tail of the stack.
popFrom :: s -> IO () Source #
pops the last element.
peeks the last element.
shrinkBy :: s -> Int -> IO () Source #
shrinks the stack.
StackFamily Stack Int Source # | |
StackFamily Clause Lit Source # |
|
StackFamily ClauseExtManager Clause Source # |
|