Maintainer | Anders Claesson <anders.claesson@gmail.com> |
---|---|
Safe Haskell | None |
Convenience functions for dealing with arrays of CLong
s.
- data CLongArray
- fromList :: [Int] -> CLongArray
- toList :: CLongArray -> [Int]
- slice :: [Int] -> CLongArray -> [CLongArray]
- unsafeSlice :: [Int] -> CLongArray -> [CLongArray]
- size :: CLongArray -> Int
- at :: CLongArray -> Int -> Int
- unsafeAt :: CLongArray -> Int -> Int
- imap :: (Int -> CLong -> CLong) -> CLongArray -> CLongArray
- unsafeNew :: Int -> (Ptr CLong -> IO ()) -> IO CLongArray
- unsafeWith :: CLongArray -> (Ptr CLong -> IO a) -> IO a
Data type
data CLongArray Source
An array of CLong
s
Conversions
fromList :: [Int] -> CLongArraySource
Construct an array from a list of elements.
toList :: CLongArray -> [Int]Source
The list of elements.
slice :: [Int] -> CLongArray -> [CLongArray]Source
Slice a CLongArray
into contiguous segments of the given
sizes. Each segment size must be positive and they must sum to the
size of the array.
unsafeSlice :: [Int] -> CLongArray -> [CLongArray]Source
Like slice
but without range checking.
Accessors
size :: CLongArray -> IntSource
The size/length of the given array.
at :: CLongArray -> Int -> IntSource
w `at` i
is the value of w
at i
, where i
is in [0..size w-1]
.
Map
imap :: (Int -> CLong -> CLong) -> CLongArray -> CLongArraySource
Apply a function to every element of an array and its index.
Low level functions
unsafeNew :: Int -> (Ptr CLong -> IO ()) -> IO CLongArraySource
Create a new array of the given size that is initialized through an IO action.
unsafeWith :: CLongArray -> (Ptr CLong -> IO a) -> IO aSource
Pass a pointer to the array to an IO action; the array may not be modified through the pointer.