on master help sign in
Use the right versions of catch and throw.
commit419ee9be61a89cc45f77831a1e4115f47f20f7dd authorBryan O'Sullivan <bos@serpentine.com> dateThu 9 Jun 2011, 21:28 (15 years ago) parenta298240
2 files changed+6−4
Data/Text/IO/Internal.hs+2 Data/Text/Lazy/IO.hs+4−4
Data/Text/IO/Internal.hs+2
@@ -19,6 +19,7 @@ module Data.Text.IO.Internal
1919 ) where
2020
2121#if __GLASGOW_HASKELL__ >= 612
22+import Control.Exception (catch)
2223import Data.IORef (readIORef, writeIORef)
2324import Data.Text (Text)
2425import Data.Text.Fusion (unstream)
@@ -31,6 +32,7 @@ import GHC.IO.Buffer (Buffer(..), CharBuffer, RawCharBuffer, bufferAdjustL,
3132 withRawBuffer, writeCharBuf)
3233import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
3334import GHC.IO.Handle.Types (Handle__(..), Newline(..))
35+import Prelude hiding (catch)
3436import System.IO (Handle)
3537import System.IO.Error (isEOFError)
3638import qualified Data.Text as T
Data/Text/Lazy/IO.hs+4−4
@@ -38,8 +38,8 @@ module Data.Text.Lazy.IO
3838 ) where
3939
4040import Data.Text.Lazy (Text)
41−import Prelude hiding (appendFile, getContents, getLine, interact, putStr,
42− putStrLn, readFile, writeFile)
41+import Prelude hiding (appendFile, catch, getContents, getLine, interact,
42+ putStr, putStrLn, readFile, writeFile)
4343import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
4444 withFile)
4545import qualified Data.Text.IO as T
@@ -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 (throw)
52+import Control.Exception (catch, throwIO)
5353import Control.Monad (when)
5454import Data.IORef (readIORef)
5555import Data.Text.IO.Internal (hGetLineWith, readChunk)
@@ -134,7 +134,7 @@ lazyReadBuffered h hh@Handle__{..} = do
134134 then return $ if isEmptyBuffer buf
135135 then (hh', empty)
136136 else (hh', L.singleton '\r')
137− else throw (augmentIOError e "hGetContents" h)
137+ else throwIO (augmentIOError e "hGetContents" h)
138138#endif
139139
140140-- | Read a single line from a handle.