@@ -46,7 +46,7 @@ import qualified Data.Text as T
4646import Data.Text.Fusion (stream, unstream)
4747import Data.Text.Fusion.Internal (Step(..), Stream(..))
4848import Data.Text.Fusion.Size (exactSize, maxSize)
49−import Data.Text.IO.Internal (getSomeCharacters, hGetLineWith, unpack, unpack_nl)
49+import Data.Text.IO.Internal (hGetLineWith, readChunk)
5050import Data.Text.Unsafe (inlinePerformIO)
5151import Foreign.Storable (peekElemOff)
5252import GHC.IO.Buffer (Buffer(..), BufferState(..), CharBufElem, CharBuffer,
@@ -99,12 +99,7 @@ hGetContents h = wantReadableHandle "hGetContents" h $ \hh -> do
9999 readAll hh@Handle__{..} = do
100100 buf <- readIORef haCharBuffer
101101 let readChunks = do
102− buf'@Buffer{..} <- getSomeCharacters hh buf
103− (t,r) <- if haInputNL == CRLF
104− then unpack_nl bufRaw bufL bufR
105− else do t <- unpack bufRaw bufL bufR
106− return (t,bufR)
107− writeIORef haCharBuffer (bufferAdjustL r buf')
102+ t <- readChunk hh buf
108103 (hh',ts) <- readAll hh
109104 return (hh', t:ts)
110105 readChunks `catch` \e -> do
@@ -115,7 +110,7 @@ hGetContents h = wantReadableHandle "hGetContents" h $ \hh -> do
115110 else (hh', [T.singleton '\r'])
116111 else throw (augmentIOError e "hGetContents" h)
117112#endif
118−
113+
119114-- | Read a single line from a handle.
120115hGetLine :: Handle -> IO Text
121116#if __GLASGOW_HASKELL__ <= 610