- data IOBuffer r el
- createIOBuffer :: Storable el => Int -> ForeignPtr Int -> ForeignPtr el -> IOBuffer r el
- null :: IOBuffer r el -> IO Bool
- empty :: Storable el => IOBuffer r el
- copyBuffer :: Storable el => IOBuffer r el -> IO (IOBuffer r el)
- append :: Storable el => IOBuffer r el -> IOBuffer r el -> IO (IOBuffer r el)
- length :: IOBuffer r el -> IO Int
- pop :: Storable el => IOBuffer r el -> IO el
- lookAtHead :: Storable el => IOBuffer r el -> IO (Maybe el)
- drop :: Int -> IOBuffer r el -> IO ()
- dropWhile :: Storable el => (el -> Bool) -> IOBuffer r el -> IO ()
- take :: Storable el => IOBuffer r el -> Int -> IO (IOBuffer r el)
- splitAt :: Storable el => IOBuffer r el -> Int -> IO (IOBuffer r el, IOBuffer r el)
- mapBuffer :: (Storable el, Storable el') => (el -> el') -> ForeignPtr Int -> ForeignPtr el' -> IOBuffer r el -> IO (IOBuffer r el')
- mapAccumBuffer :: (Storable el, Storable el') => (acc -> el -> (acc, el')) -> ForeignPtr Int -> ForeignPtr el' -> acc -> IOBuffer r el -> IO (acc, IOBuffer r el')
- foldl' :: Storable b => (a -> b -> a) -> a -> IOBuffer r b -> IO a
- hopfoldl' :: Storable b => Int -> (a -> b -> a) -> a -> IOBuffer r b -> IO a
- hopfoldM :: Storable b => Int -> (a -> b -> IO a) -> a -> IOBuffer r b -> IO a
- decimate :: Storable b => Int -> IOBuffer r b -> IO (IOBuffer r b)
- castBuffer :: forall r m el el'. (Storable el, Storable el') => IOBuffer r el -> IO (IOBuffer r el')
- freeze :: (Storable el, Vector v el, Vector v Int) => IOBuffer r el -> IO (v el)
- thaw :: (Storable el, Vector v el) => v el -> IO (IOBuffer r el)
- hPut :: forall r el. Storable el => Handle -> IOBuffer r el -> IO ()
- unsafeToForeignPtr :: IOBuffer r el -> (Int, ForeignPtr Int, ForeignPtr el)
Documentation
A mutable buffer to hold storable elements. This data type supports memory recycling.
Storable el => MonadTrans (MIteratee (IOBuffer s el)) | |
(MonadIO m, Storable el) => Monad (MIteratee (IOBuffer r el) m) | |
(MonadCatchIO m, Storable el) => MonadCatchIO (MIteratee (IOBuffer r el) m) | |
Storable el => NullPoint (IOBuffer r el) | |
(MonadIO m, Storable el) => MonadIO (MIteratee (IOBuffer r el) m) |
createIOBuffer :: Storable el => Int -> ForeignPtr Int -> ForeignPtr el -> IOBuffer r elSource
Create a buffer from a length and data array.
copyBuffer :: Storable el => IOBuffer r el -> IO (IOBuffer r el)Source
Copy data from one buffer to another.
append :: Storable el => IOBuffer r el -> IOBuffer r el -> IO (IOBuffer r el)Source
Append two buffers. Copies data from both into a new buffer.
pop :: Storable el => IOBuffer r el -> IO elSource
Retrieve the front element from the buffer and advance the internal pointer. It is an error to call this on an empty buffer.
lookAtHead :: Storable el => IOBuffer r el -> IO (Maybe el)Source
Retrieve the first element, if it exists. This function does not advance the buffer pointer.
drop :: Int -> IOBuffer r el -> IO ()Source
Drop n elements from the front of the buffer. if the buffer has fewer elements, all are dropped.
take :: Storable el => IOBuffer r el -> Int -> IO (IOBuffer r el)Source
Create a new buffer from the first n elements, sharing data. This function advances the pointer of the original buffer.
splitAt :: Storable el => IOBuffer r el -> Int -> IO (IOBuffer r el, IOBuffer r el)Source
Split one buffer to two, sharing storage.
mapBuffer :: (Storable el, Storable el') => (el -> el') -> ForeignPtr Int -> ForeignPtr el' -> IOBuffer r el -> IO (IOBuffer r el')Source
copy data from one buffer to another with the specified map function. this operation drains the original buffer.
mapAccumBuffer :: (Storable el, Storable el') => (acc -> el -> (acc, el')) -> ForeignPtr Int -> ForeignPtr el' -> acc -> IOBuffer r el -> IO (acc, IOBuffer r el')Source
decimate :: Storable b => Int -> IOBuffer r b -> IO (IOBuffer r b)Source
Create a new buffer of every nth
element. The original buffer is
not altered.
castBuffer :: forall r m el el'. (Storable el, Storable el') => IOBuffer r el -> IO (IOBuffer r el')Source
Cast a buffer to a different type. Any extra data is truncated. This is not safe unless the buffer offset is 0.
freeze :: (Storable el, Vector v el, Vector v Int) => IOBuffer r el -> IO (v el)Source
Safely convert an IOBuffer to a Vector.
thaw :: (Storable el, Vector v el) => v el -> IO (IOBuffer r el)Source
Safely convert a Vector to an IOBuffer
hPut :: forall r el. Storable el => Handle -> IOBuffer r el -> IO ()Source
Write out the contents of the IOBuffer to a handle. This operation drains the buffer.
unsafeToForeignPtr :: IOBuffer r el -> (Int, ForeignPtr Int, ForeignPtr el)Source