Adapt for ghc-7.6 #35

Merged
merged 1 commit into from Aug 14, 2012
View
@@ -38,15 +38,15 @@ module Data.Text.IO
) where
import Data.Text (Text)
-import Prelude hiding (appendFile, catch, getContents, getLine, interact,
+import Prelude hiding (appendFile, getContents, getLine, interact,
putStr, putStrLn, readFile, writeFile)
import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
withFile)
#if __GLASGOW_HASKELL__ <= 610
import qualified Data.ByteString.Char8 as B
import Data.Text.Encoding (decodeUtf8, encodeUtf8)
#else
-import Control.Exception (catch, throwIO)
+import qualified Control.Exception as E
import Control.Monad (liftM2, when)
import Data.IORef (readIORef, writeIORef)
import qualified Data.Text as T
@@ -123,10 +123,10 @@ hGetContents h = do
return $ if isEmptyBuffer buf
then T.empty
else T.singleton '\r'
- | otherwise = throwIO (augmentIOError e "hGetContents" h)
+ | otherwise = E.throwIO (augmentIOError e "hGetContents" h)
readChunks = do
buf <- readIORef haCharBuffer
- t <- readChunk hh buf `catch` catchError
+ t <- readChunk hh buf `E.catch` catchError
if T.null t
then return [t]
else (t:) `fmap` readChunks
@@ -144,10 +144,10 @@ chooseGoodBuffering h = do
bufMode <- hGetBuffering h
case bufMode of
BlockBuffering Nothing -> do
- d <- catch (liftM2 (-) (hFileSize h) (hTell h)) $ \(e::IOException) ->
+ d <- E.catch (liftM2 (-) (hFileSize h) (hTell h)) $ \(e::IOException) ->
if ioe_type e == InappropriateType
then return 16384 -- faster than the 2KB default
- else throwIO e
+ else E.throwIO e
when (d > 0) . hSetBuffering h . BlockBuffering . Just . fromIntegral $ d
_ -> return ()
#endif
View
@@ -19,7 +19,7 @@ module Data.Text.IO.Internal
) where
#if __GLASGOW_HASKELL__ >= 612
-import Control.Exception (catch)
+import qualified Control.Exception as E
import Data.IORef (readIORef, writeIORef)
import Data.Text (Text)
import Data.Text.Fusion (unstream)
@@ -32,7 +32,6 @@ import GHC.IO.Buffer (Buffer(..), CharBuffer, RawCharBuffer, bufferAdjustL,
withRawBuffer, writeCharBuf)
import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
import GHC.IO.Handle.Types (Handle__(..), Newline(..))
-import Prelude hiding (catch)
import System.IO (Handle)
import System.IO.Error (isEOFError)
import qualified Data.Text as T
@@ -84,7 +83,7 @@ hGetLineLoop hh@Handle__{..} = go where
-- This function is lifted almost verbatim from GHC.IO.Handle.Text.
maybeFillReadBuffer :: Handle__ -> CharBuffer -> IO (Maybe CharBuffer)
maybeFillReadBuffer handle_ buf
- = catch (Just `fmap` getSomeCharacters handle_ buf) $ \e ->
+ = E.catch (Just `fmap` getSomeCharacters handle_ buf) $ \e ->
if isEOFError e
then return Nothing
else ioError e
View
@@ -38,7 +38,7 @@ module Data.Text.Lazy.IO
) where
import Data.Text.Lazy (Text)
-import Prelude hiding (appendFile, catch, getContents, getLine, interact,
+import Prelude hiding (appendFile, getContents, getLine, interact,
putStr, putStrLn, readFile, writeFile)
import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
withFile)
@@ -49,7 +49,7 @@ import Data.Text.Lazy.Encoding (decodeUtf8)
import qualified Data.ByteString.Char8 as S8
import qualified Data.ByteString.Lazy.Char8 as L8
#else
-import Control.Exception (catch, throwIO)
+import qualified Control.Exception as E
import Control.Monad (when)
import Data.IORef (readIORef)
import Data.Text.IO.Internal (hGetLineWith, readChunk)
@@ -128,13 +128,13 @@ lazyReadBuffered h hh@Handle__{..} = do
buf <- readIORef haCharBuffer
(do t <- readChunk hh buf
ts <- lazyRead h
- return (hh, chunk t ts)) `catch` \e -> do
+ return (hh, chunk t ts)) `E.catch` \e -> do
(hh', _) <- hClose_help hh
if isEOFError e
then return $ if isEmptyBuffer buf
then (hh', empty)
else (hh', L.singleton '\r')
- else throwIO (augmentIOError e "hGetContents" h)
+ else E.throwIO (augmentIOError e "hGetContents" h)
#endif
-- | Read a single line from a handle.
View
@@ -147,7 +147,7 @@ library
build-depends: integer-simple >= 0.1 && < 0.5
else
cpp-options: -DINTEGER_GMP
- build-depends: integer-gmp >= 0.2 && < 0.5
+ build-depends: integer-gmp >= 0.2 && < 0.6
if impl(ghc >= 6.9) && impl(ghc < 6.11)