List conversions and utilities.
- fromList :: [c] -> IO (InputStream c)
- toList :: InputStream a -> IO [a]
- outputToList :: (OutputStream a -> IO b) -> IO [a]
- writeList :: [a] -> OutputStream a -> IO ()
- chunkList :: Int -> InputStream a -> IO (InputStream [a])
- concatLists :: InputStream [a] -> IO (InputStream a)
- listOutputStream :: IO (OutputStream c, IO [c])
InputStream, converting it to a list. N.B. that this function
reads the entire
InputStream strictly into memory and as such is not
recommended for streaming applications or where the size of the input is not
bounded or known.
The flush action resets the store.
Note that this function will buffer any input sent to it on the heap. Please don't use this unless you're sure that the amount of input provided is bounded and will fit in memory without issues.
ghci> (os, flush) <- Streams.
listOutputStream:: IO (
OutputStreamInt, IO [Int]) ghci> Streams.
writeList[1, 2] os ghci> flush [1, 2] ghci> Streams.
writeList[3, 4] os ghci> flush [3, 4]