From 655f4b90bc8a5687154a8b0e2518993ef09c4cf4 Mon Sep 17 00:00:00 2001 From: Victor Denisov Date: Sun, 1 May 2016 19:05:51 -0700 Subject: [PATCH] Rename readExactly to read --- Database/MongoDB/Internal/Connection.hs | 4 ++-- Database/MongoDB/Internal/Protocol.hs | 4 ++-- Database/MongoDB/Internal/Tls.hs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Database/MongoDB/Internal/Connection.hs b/Database/MongoDB/Internal/Connection.hs index a55f0a6..8679c5e 100644 --- a/Database/MongoDB/Internal/Connection.hs +++ b/Database/MongoDB/Internal/Connection.hs @@ -16,7 +16,7 @@ import System.IO -- -- `read` should return `ByteString.null` on EOF data Connection = Connection { - readExactly :: Int -> IO ByteString, + read :: Int -> IO ByteString, write :: ByteString -> IO (), flush :: IO (), close :: IO ()} @@ -25,7 +25,7 @@ fromHandle :: Handle -> IO Connection -- ^ Make connection form handle fromHandle handle = do return Connection - { readExactly = ByteString.hGet handle + { read = ByteString.hGet handle , write = ByteString.hPut handle , flush = hFlush handle , close = hClose handle diff --git a/Database/MongoDB/Internal/Protocol.hs b/Database/MongoDB/Internal/Protocol.hs index fffbb88..4c660d8 100644 --- a/Database/MongoDB/Internal/Protocol.hs +++ b/Database/MongoDB/Internal/Protocol.hs @@ -207,8 +207,8 @@ readMessage :: Connection -> IO Response -- ^ read response from a connection readMessage conn = readResp where readResp = do - len <- fromEnum . decodeSize . L.fromStrict <$> Connection.readExactly conn 4 - runGet getReply . L.fromStrict <$> Connection.readExactly conn len + len <- fromEnum . decodeSize . L.fromStrict <$> Connection.read conn 4 + runGet getReply . L.fromStrict <$> Connection.read conn len decodeSize = subtract 4 . runGet getInt32 type FullCollection = Text diff --git a/Database/MongoDB/Internal/Tls.hs b/Database/MongoDB/Internal/Tls.hs index 3579a9b..2b7ae26 100644 --- a/Database/MongoDB/Internal/Tls.hs +++ b/Database/MongoDB/Internal/Tls.hs @@ -56,7 +56,7 @@ tlsConnection :: TLS.Context -> IO () -> IO Connection tlsConnection ctx close = do restRef <- newIORef mempty return Connection - { Connection.readExactly = \count -> let + { Connection.read = \count -> let readSome = do rest <- readIORef restRef writeIORef restRef mempty