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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe