on master help sign in
Adapt for ghc-7.6
commit257dc4f31ea6de44b8d3008bee6cd8869b785d29 authorSimon Hengel <sol@typeful.net> dateTue 14 Aug 2012, 09:13 (14 years ago) parent9eab1f7
4 files changed+13−14
Data/Text/IO.hs+6−6 Data/Text/IO/Internal.hs+2−3 Data/Text/Lazy/IO.hs+4−4 text.cabal+1−1
Data/Text/IO.hs+6−6
@@ -38,7 +38,7 @@ module Data.Text.IO
3838 ) where
3939
4040import Data.Text (Text)
41−import Prelude hiding (appendFile, catch, getContents, getLine, interact,
41+import Prelude hiding (appendFile, getContents, getLine, interact,
4242 putStr, putStrLn, readFile, writeFile)
4343import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
4444 withFile)
@@ -46,7 +46,7 @@ import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
4646import qualified Data.ByteString.Char8 as B
4747import Data.Text.Encoding (decodeUtf8, encodeUtf8)
4848#else
49−import Control.Exception (catch, throwIO)
49+import qualified Control.Exception as E
5050import Control.Monad (liftM2, when)
5151import Data.IORef (readIORef, writeIORef)
5252import qualified Data.Text as T
@@ -123,10 +123,10 @@ hGetContents h = do
123123 return $ if isEmptyBuffer buf
124124 then T.empty
125125 else T.singleton '\r'
126− | otherwise = throwIO (augmentIOError e "hGetContents" h)
126+ | otherwise = E.throwIO (augmentIOError e "hGetContents" h)
127127 readChunks = do
128128 buf <- readIORef haCharBuffer
129− t <- readChunk hh buf `catch` catchError
129+ t <- readChunk hh buf `E.catch` catchError
130130 if T.null t
131131 then return [t]
132132 else (t:) `fmap` readChunks
@@ -144,10 +144,10 @@ chooseGoodBuffering h = do
144144 bufMode <- hGetBuffering h
145145 case bufMode of
146146 BlockBuffering Nothing -> do
147− d <- catch (liftM2 (-) (hFileSize h) (hTell h)) $ \(e::IOException) ->
147+ d <- E.catch (liftM2 (-) (hFileSize h) (hTell h)) $ \(e::IOException) ->
148148 if ioe_type e == InappropriateType
149149 then return 16384 -- faster than the 2KB default
150− else throwIO e
150+ else E.throwIO e
151151 when (d > 0) . hSetBuffering h . BlockBuffering . Just . fromIntegral $ d
152152 _ -> return ()
153153#endif
Data/Text/IO/Internal.hs+2−3
@@ -19,7 +19,7 @@ module Data.Text.IO.Internal
1919 ) where
2020
2121#if __GLASGOW_HASKELL__ >= 612
22−import Control.Exception (catch)
22+import qualified Control.Exception as E
2323import Data.IORef (readIORef, writeIORef)
2424import Data.Text (Text)
2525import Data.Text.Fusion (unstream)
@@ -32,7 +32,6 @@ import GHC.IO.Buffer (Buffer(..), CharBuffer, RawCharBuffer, bufferAdjustL,
3232 withRawBuffer, writeCharBuf)
3333import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
3434import GHC.IO.Handle.Types (Handle__(..), Newline(..))
35−import Prelude hiding (catch)
3635import System.IO (Handle)
3736import System.IO.Error (isEOFError)
3837import qualified Data.Text as T
@@ -84,7 +83,7 @@ hGetLineLoop hh@Handle__{..} = go where
8483-- This function is lifted almost verbatim from GHC.IO.Handle.Text.
8584maybeFillReadBuffer :: Handle__ -> CharBuffer -> IO (Maybe CharBuffer)
8685maybeFillReadBuffer handle_ buf
87− = catch (Just `fmap` getSomeCharacters handle_ buf) $ \e ->
86+ = E.catch (Just `fmap` getSomeCharacters handle_ buf) $ \e ->
8887 if isEOFError e
8988 then return Nothing
9089 else ioError e
Data/Text/Lazy/IO.hs+4−4
@@ -38,7 +38,7 @@ module Data.Text.Lazy.IO
3838 ) where
3939
4040import Data.Text.Lazy (Text)
41−import Prelude hiding (appendFile, catch, getContents, getLine, interact,
41+import Prelude hiding (appendFile, getContents, getLine, interact,
4242 putStr, putStrLn, readFile, writeFile)
4343import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
4444 withFile)
@@ -49,7 +49,7 @@ import Data.Text.Lazy.Encoding (decodeUtf8)
4949import qualified Data.ByteString.Char8 as S8
5050import qualified Data.ByteString.Lazy.Char8 as L8
5151#else
52−import Control.Exception (catch, throwIO)
52+import qualified Control.Exception as E
5353import Control.Monad (when)
5454import Data.IORef (readIORef)
5555import Data.Text.IO.Internal (hGetLineWith, readChunk)
@@ -128,13 +128,13 @@ lazyReadBuffered h hh@Handle__{..} = do
128128 buf <- readIORef haCharBuffer
129129 (do t <- readChunk hh buf
130130 ts <- lazyRead h
131− return (hh, chunk t ts)) `catch` \e -> do
131+ return (hh, chunk t ts)) `E.catch` \e -> do
132132 (hh', _) <- hClose_help hh
133133 if isEOFError e
134134 then return $ if isEmptyBuffer buf
135135 then (hh', empty)
136136 else (hh', L.singleton '\r')
137− else throwIO (augmentIOError e "hGetContents" h)
137+ else E.throwIO (augmentIOError e "hGetContents" h)
138138#endif
139139
140140-- | Read a single line from a handle.
text.cabal+1−1
@@ -147,7 +147,7 @@ library
147147 build-depends: integer-simple >= 0.1 && < 0.5
148148 else
149149 cpp-options: -DINTEGER_GMP
150− build-depends: integer-gmp >= 0.2 && < 0.5
150+ build-depends: integer-gmp >= 0.2 && < 0.6
151151
152152
153153 if impl(ghc >= 6.9) && impl(ghc < 6.11)