|
@@ -284,10 +284,11 @@ recieveN n = LBS.toStrict <$> recieveN' n
|
|
|
|
|
|
-- | Lazy version of recieveN
|
|
-- | Lazy version of recieveN
|
|
recieveN' :: MonadIO m => Int -> Streamline m LBS.ByteString
|
|
recieveN' :: MonadIO m => Int -> Streamline m LBS.ByteString
|
|
-recieveN' n = Streamline $ \cl ->
|
|
|
|
- do
|
|
|
|
- (tt, cl') <- recieve cl n
|
|
|
|
- return (LBS.fromChunks tt, cl')
|
|
|
|
|
|
+recieveN' n | n <= 0 = return ""
|
|
|
|
+ | otherwise = Streamline $ \cl ->
|
|
|
|
+ do
|
|
|
|
+ (tt, cl') <- recieve cl n
|
|
|
|
+ return (LBS.fromChunks tt, cl')
|
|
where
|
|
where
|
|
recieve d b
|
|
recieve d b
|
|
| isEOF d = eofError "System.IO.Uniform.Streamline.lazyRecieveN"
|
|
| isEOF d = eofError "System.IO.Uniform.Streamline.lazyRecieveN"
|