on master help sign in
Use the right versions of catch and throw.
419ee9bBryan O'Sullivan
Data/Text/IO/Internal.hs+2
@@ -19,6 +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)
22import Data.IORef (readIORef, writeIORef)
23import Data.IORef (readIORef, writeIORef)
23import Data.Text (Text)
24import Data.Text (Text)
24import Data.Text.Fusion (unstream)
25import Data.Text.Fusion (unstream)
@@ -31,6 +32,7 @@ import GHC.IO.Buffer (Buffer(..), CharBuffer, RawCharBuffer, bufferAdjustL,
31 withRawBuffer, writeCharBuf)
32 withRawBuffer, writeCharBuf)
32import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
33import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
33import GHC.IO.Handle.Types (Handle__(..), Newline(..))
34import GHC.IO.Handle.Types (Handle__(..), Newline(..))
35+import Prelude hiding (catch)
34import System.IO (Handle)
36import System.IO (Handle)
35import System.IO.Error (isEOFError)
37import System.IO.Error (isEOFError)
36import qualified Data.Text as T
38import qualified Data.Text as T
Data/Text/Lazy/IO.hs+4−4
@@ -38,8 +38,8 @@ 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, getContents, getLine, interact, putStr,
41+import Prelude hiding (appendFile, catch, getContents, getLine, interact,
42− 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)
45import qualified Data.Text.IO as T
45import qualified Data.Text.IO as T
@@ -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 (throw)
52+import Control.Exception (catch, throwIO)
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)
@@ -134,7 +134,7 @@ lazyReadBuffered h hh@Handle__{..} = do
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 throw (augmentIOError e "hGetContents" h)
137+ else 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.