Hoogle Search
Within LTS Haskell 24.43 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
toByteStringIO :: (ByteString -> IO ()) -> Builder -> IO ()streaming-commons Data.Streaming.ByteString.Builder Run the builder with a defaultChunkSized buffer and execute the given IO action whenever the buffer is full or gets flushed.
toByteStringIO = toByteStringIOWith defaultChunkSize
Since 0.1.9toByteStringIOWith :: Int -> (ByteString -> IO ()) -> Builder -> IO ()streaming-commons Data.Streaming.ByteString.Builder toByteStringIOWith bufSize io b runs the builder b with a buffer of at least the size bufSize and executes the IO action io whenever the buffer is full. Compared to toLazyByteStringWith this function requires less allocation, as the output buffer is only allocated once at the start of the serialization and whenever something bigger than the current buffer size has to be copied into the buffer, which should happen very seldomly for the default buffer size of 32kb. Hence, the pressure on the garbage collector is reduced, which can be an advantage when building long sequences of bytes. Since 0.1.9
toByteStringIOWithBuffer :: Int -> (ByteString -> IO ()) -> Builder -> ForeignPtr Word8 -> IO ()streaming-commons Data.Streaming.ByteString.Builder Use a pre-existing buffer to toByteStringIOWith. Since 0.1.9
genByteString :: RandomGen g => Int -> g -> (ByteString, g)MonadRandom Control.Monad.Random.Lazy Generates a ByteString of the specified size using a pure pseudo-random number generator. See uniformByteStringM for the monadic version.
Examples
>>> import System.Random >>> import Data.ByteString >>> let pureGen = mkStdGen 137 >>> unpack . fst . genByteString 10 $ pureGen [51,123,251,37,49,167,90,109,1,4]
genShortByteString :: RandomGen g => Int -> g -> (ShortByteString, g)MonadRandom Control.Monad.Random.Lazy genShortByteString n g returns a ShortByteString of length n filled with pseudo-random bytes.
genByteString :: RandomGen g => Int -> g -> (ByteString, g)MonadRandom Control.Monad.Random.Strict Generates a ByteString of the specified size using a pure pseudo-random number generator. See uniformByteStringM for the monadic version.
Examples
>>> import System.Random >>> import Data.ByteString >>> let pureGen = mkStdGen 137 >>> unpack . fst . genByteString 10 $ pureGen [51,123,251,37,49,167,90,109,1,4]
genShortByteString :: RandomGen g => Int -> g -> (ShortByteString, g)MonadRandom Control.Monad.Random.Strict genShortByteString n g returns a ShortByteString of length n filled with pseudo-random bytes.
fromByteString :: Storable t => ByteString -> Vector thmatrix Numeric.LinearAlgebra.Devel No documentation available.
toByteString :: Storable t => Vector t -> ByteStringhmatrix Numeric.LinearAlgebra.Devel No documentation available.
fromByteString :: ByteString -> IO (InputStream ByteString)io-streams System.IO.Streams.ByteString Creates an InputStream from a ByteString.