Oops, false alarm. Please ignore - and sorry about it. Regards, Kashyap On Wed, Feb 27, 2013 at 1:32 PM, C K Kashyap <ckkashyap@gmail.com> wrote:
Hi,
I have the following code - It looks like things go okay until concatination is attempted. I get the following output
There are 2258 ByteStrings *** Exception: <stdout>: hPutBuf: resource exhausted (Not enough space)
I am thinking that I should do strict concatination at each point in the support function - how can I go about doing so? (BS is the lazy.char8 bytestring)
connectionGetNBytes :: NC.Connection -> Int -> IO ByteString connectionGetNBytes c n = do bs <- connectionGetNBytes' c n putStrLn ("There are " ++ (show (length bs)) ++ " ByteStrings") return (BS.concat bs)
connectionGetNBytes' :: NC.Connection -> Int -> IO [ByteString] connectionGetNBytes' _ 0 = return [] connectionGetNBytes' c n = do l <- NC.connectionGet c n let ll = BS.length l remaining <- connectionGetNBytes' c (n - ll) return (l:crlfStr:remaining)
Regards, Kashyap