on master help sign in
Adapt for ghc-7.6
257dc4fSimon Hengel
Data/Text/IO.hs+6−6
@@ -38,7 +38,7 @@ module Data.Text.IO
38 ) where
38 ) where
39
39
40import Data.Text (Text)
40import Data.Text (Text)
41−import Prelude hiding (appendFile, catch, getContents, getLine, interact,
41+import Prelude hiding (appendFile, getContents, getLine, interact,
42 putStr, putStrLn, readFile, writeFile)
42 putStr, putStrLn, readFile, writeFile)
43import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
43import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
44 withFile)
44 withFile)
@@ -46,7 +46,7 @@ import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
46import qualified Data.ByteString.Char8 as B
46import qualified Data.ByteString.Char8 as B
47import Data.Text.Encoding (decodeUtf8, encodeUtf8)
47import Data.Text.Encoding (decodeUtf8, encodeUtf8)
48#else
48#else
49−import Control.Exception (catch, throwIO)
49+import qualified Control.Exception as E
50import Control.Monad (liftM2, when)
50import Control.Monad (liftM2, when)
51import Data.IORef (readIORef, writeIORef)
51import Data.IORef (readIORef, writeIORef)
52import qualified Data.Text as T
52import qualified Data.Text as T
@@ -123,10 +123,10 @@ hGetContents h = do
123 return $ if isEmptyBuffer buf
123 return $ if isEmptyBuffer buf
124 then T.empty
124 then T.empty
125 else T.singleton '\r'
125 else T.singleton '\r'
126− | otherwise = throwIO (augmentIOError e "hGetContents" h)
126+ | otherwise = E.throwIO (augmentIOError e "hGetContents" h)
127 readChunks = do
127 readChunks = do
128 buf <- readIORef haCharBuffer
128 buf <- readIORef haCharBuffer
129− t <- readChunk hh buf `catch` catchError
129+ t <- readChunk hh buf `E.catch` catchError
130 if T.null t
130 if T.null t
131 then return [t]
131 then return [t]
132 else (t:) `fmap` readChunks
132 else (t:) `fmap` readChunks
@@ -144,10 +144,10 @@ chooseGoodBuffering h = do
144 bufMode <- hGetBuffering h
144 bufMode <- hGetBuffering h
145 case bufMode of
145 case bufMode of
146 BlockBuffering Nothing -> do
146 BlockBuffering Nothing -> do
147− d <- catch (liftM2 (-) (hFileSize h) (hTell h)) $ \(e::IOException) ->
147+ d <- E.catch (liftM2 (-) (hFileSize h) (hTell h)) $ \(e::IOException) ->
148 if ioe_type e == InappropriateType
148 if ioe_type e == InappropriateType
149 then return 16384 -- faster than the 2KB default
149 then return 16384 -- faster than the 2KB default
150− else throwIO e
150+ else E.throwIO e
151 when (d > 0) . hSetBuffering h . BlockBuffering . Just . fromIntegral $ d
151 when (d > 0) . hSetBuffering h . BlockBuffering . Just . fromIntegral $ d
152 _ -> return ()
152 _ -> return ()
153#endif
153#endif
Data/Text/IO/Internal.hs+2−3
@@ -19,7 +19,7 @@ module Data.Text.IO.Internal
19 ) where
19 ) where
20
20
21#if __GLASGOW_HASKELL__ >= 612
21#if __GLASGOW_HASKELL__ >= 612
22−import Control.Exception (catch)
22+import qualified Control.Exception as E
23import Data.IORef (readIORef, writeIORef)
23import Data.IORef (readIORef, writeIORef)
24import Data.Text (Text)
24import Data.Text (Text)
25import Data.Text.Fusion (unstream)
25import Data.Text.Fusion (unstream)
@@ -32,7 +32,6 @@ import GHC.IO.Buffer (Buffer(..), CharBuffer, RawCharBuffer, bufferAdjustL,
32 withRawBuffer, writeCharBuf)
32 withRawBuffer, writeCharBuf)
33import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
33import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
34import GHC.IO.Handle.Types (Handle__(..), Newline(..))
34import GHC.IO.Handle.Types (Handle__(..), Newline(..))
35−import Prelude hiding (catch)
36import System.IO (Handle)
35import System.IO (Handle)
37import System.IO.Error (isEOFError)
36import System.IO.Error (isEOFError)
38import qualified Data.Text as T
37import qualified Data.Text as T
@@ -84,7 +83,7 @@ hGetLineLoop hh@Handle__{..} = go where
84-- This function is lifted almost verbatim from GHC.IO.Handle.Text.
83-- This function is lifted almost verbatim from GHC.IO.Handle.Text.
85maybeFillReadBuffer :: Handle__ -> CharBuffer -> IO (Maybe CharBuffer)
84maybeFillReadBuffer :: Handle__ -> CharBuffer -> IO (Maybe CharBuffer)
86maybeFillReadBuffer handle_ buf
85maybeFillReadBuffer handle_ buf
87− = catch (Just `fmap` getSomeCharacters handle_ buf) $ \e ->
86+ = E.catch (Just `fmap` getSomeCharacters handle_ buf) $ \e ->
88 if isEOFError e
87 if isEOFError e
89 then return Nothing
88 then return Nothing
90 else ioError e
89 else ioError e
Data/Text/Lazy/IO.hs+4−4
@@ -38,7 +38,7 @@ module Data.Text.Lazy.IO
38 ) where
38 ) where
39
39
40import Data.Text.Lazy (Text)
40import Data.Text.Lazy (Text)
41−import Prelude hiding (appendFile, catch, getContents, getLine, interact,
41+import Prelude hiding (appendFile, getContents, getLine, interact,
42 putStr, putStrLn, readFile, writeFile)
42 putStr, putStrLn, readFile, writeFile)
43import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
43import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
44 withFile)
44 withFile)
@@ -49,7 +49,7 @@ import Data.Text.Lazy.Encoding (decodeUtf8)
49import qualified Data.ByteString.Char8 as S8
49import qualified Data.ByteString.Char8 as S8
50import qualified Data.ByteString.Lazy.Char8 as L8
50import qualified Data.ByteString.Lazy.Char8 as L8
51#else
51#else
52−import Control.Exception (catch, throwIO)
52+import qualified Control.Exception as E
53import Control.Monad (when)
53import Control.Monad (when)
54import Data.IORef (readIORef)
54import Data.IORef (readIORef)
55import Data.Text.IO.Internal (hGetLineWith, readChunk)
55import Data.Text.IO.Internal (hGetLineWith, readChunk)
@@ -128,13 +128,13 @@ lazyReadBuffered h hh@Handle__{..} = do
128 buf <- readIORef haCharBuffer
128 buf <- readIORef haCharBuffer
129 (do t <- readChunk hh buf
129 (do t <- readChunk hh buf
130 ts <- lazyRead h
130 ts <- lazyRead h
131− return (hh, chunk t ts)) `catch` \e -> do
131+ return (hh, chunk t ts)) `E.catch` \e -> do
132 (hh', _) <- hClose_help hh
132 (hh', _) <- hClose_help hh
133 if isEOFError e
133 if isEOFError e
134 then return $ if isEmptyBuffer buf
134 then return $ if isEmptyBuffer buf
135 then (hh', empty)
135 then (hh', empty)
136 else (hh', L.singleton '\r')
136 else (hh', L.singleton '\r')
137− else throwIO (augmentIOError e "hGetContents" h)
137+ else E.throwIO (augmentIOError e "hGetContents" h)
138#endif
138#endif
139
139
140-- | Read a single line from a handle.
140-- | Read a single line from a handle.
text.cabal+1−1
@@ -147,7 +147,7 @@ library
147 build-depends: integer-simple >= 0.1 && < 0.5
147 build-depends: integer-simple >= 0.1 && < 0.5
148 else
148 else
149 cpp-options: -DINTEGER_GMP
149 cpp-options: -DINTEGER_GMP
150− build-depends: integer-gmp >= 0.2 && < 0.5
150+ build-depends: integer-gmp >= 0.2 && < 0.6
151
151
152
152
153 if impl(ghc >= 6.9) && impl(ghc < 6.11)
153 if impl(ghc >= 6.9) && impl(ghc < 6.11)