@@ -46,10 +46,6 @@ import Prelude hiding (appendFile, getContents, getLine, interact,
4646 putStr, putStrLn, readFile, writeFile)
4747import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
4848 withFile)
49−#if __GLASGOW_HASKELL__ <= 610
50−import qualified Data.ByteString.Char8 as B
51−import Data.Text.Encoding (decodeUtf8, encodeUtf8)
52−#else
5349import qualified Control.Exception as E
5450import Control.Monad (liftM2, when)
5551import Data.IORef (readIORef, writeIORef)
@@ -68,7 +64,6 @@ import GHC.IO.Handle.Types (BufferList(..), BufferMode(..), Handle__(..),
6864 HandleType(..), Newline(..))
6965import System.IO (hGetBuffering, hFileSize, hSetBuffering, hTell)
7066import System.IO.Error (isEOFError)
71−#endif
7267
7368-- $performance
7469-- #performance#
@@ -137,9 +132,6 @@ hGetChunk h = wantReadableHandle "hGetChunk" h readSingleChunk
137132-- result to construct its result. For files more than a half of
138133-- available RAM in size, this may result in memory exhaustion.
139134hGetContents :: Handle -> IO Text
140−#if __GLASGOW_HASKELL__ <= 610
141−hGetContents = fmap decodeUtf8 . B.hGetContents
142−#else
143135hGetContents h = do
144136 chooseGoodBuffering h
145137 wantReadableHandle "hGetContents" h readAll
@@ -171,21 +163,13 @@ chooseGoodBuffering h = do
171163 else E.throwIO e
172164 when (d > 0) . hSetBuffering h . BlockBuffering . Just . fromIntegral $ d
173165 _ -> return ()
174−#endif
175166
176167-- | Read a single line from a handle.
177168hGetLine :: Handle -> IO Text
178−#if __GLASGOW_HASKELL__ <= 610
179−hGetLine = fmap decodeUtf8 . B.hGetLine
180−#else
181169hGetLine = hGetLineWith T.concat
182−#endif
183170
184171-- | Write a string to a handle.
185172hPutStr :: Handle -> Text -> IO ()
186−#if __GLASGOW_HASKELL__ <= 610
187−hPutStr h = B.hPutStr h . encodeUtf8
188−#else
189173-- This function is lifted almost verbatim from GHC.IO.Handle.Text.
190174hPutStr h t = do
191175 (buffer_mode, nl) <-
@@ -295,7 +279,6 @@ commitBuffer hdl !raw !sz !count flush release =
295279 wantWritableHandle "commitAndReleaseBuffer" hdl $
296280 commitBuffer' raw sz count flush release
297281{-# INLINE commitBuffer #-}
298−#endif
299282
300283-- | Write a string to a handle, followed by a newline.
301284hPutStrLn :: Handle -> Text -> IO ()