mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 10:19:51 +00:00
update library version.
This commit is contained in:
parent
698c1c2b7a
commit
80fd8e70f0
2 changed files with 10 additions and 10 deletions
|
|
@ -37,18 +37,18 @@ getI = parserToIteratee get
|
|||
-- | Enumerator
|
||||
enumHandleNonBlocking :: MonadIO m => Int -> Handle -> I.Enumerator B.ByteString m a
|
||||
enumHandleNonBlocking bufSize h =
|
||||
I.enumFromCallback $ readSome bufSize h
|
||||
I.enumFromCallback (readSome bufSize h) ()
|
||||
|
||||
readSome :: MonadIO m => Int -> Handle -> m (Either SomeException (Bool, B.ByteString))
|
||||
readSome bufSize h = liftIO $ do
|
||||
readSome :: MonadIO m => Int -> Handle -> st -> m (Either SomeException ((Bool, st), B.ByteString))
|
||||
readSome bufSize h st = liftIO $ do
|
||||
ebs <- try $ hGetSome bufSize h
|
||||
case ebs of
|
||||
Left exc ->
|
||||
return $ Left (exc :: SomeException)
|
||||
Right bs | B.null bs ->
|
||||
return $ Right (False, B.empty)
|
||||
return $ Right ((False, st), B.empty)
|
||||
Right bs ->
|
||||
return $ Right (True, bs)
|
||||
return $ Right ((True, st), bs)
|
||||
|
||||
hGetSome :: Int -> Handle -> IO B.ByteString
|
||||
hGetSome bufSize h = do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue