From 31107741f0ee69d444e5f9ed2d8272583024e10c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 23 Sep 2012 21:43:11 -0700 Subject: Removed unneeded CPP conditional. Removed code that was conditional on base < 4.2, since now we require base >= 4.2. --- src/Text/Pandoc/UTF8.hs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/src/Text/Pandoc/UTF8.hs b/src/Text/Pandoc/UTF8.hs index 1d0eb4aee..aa3a9da04 100644 --- a/src/Text/Pandoc/UTF8.hs +++ b/src/Text/Pandoc/UTF8.hs @@ -46,8 +46,6 @@ where import Codec.Binary.UTF8.String (encodeString, decodeString) #endif -#if MIN_VERSION_base(4,2,0) - import System.IO hiding (readFile, writeFile, getContents, putStr, putStrLn, hPutStr, hPutStrLn, hGetContents) import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn ) @@ -79,48 +77,6 @@ hPutStrLn h s = hSetEncoding h utf8 >> IO.hPutStrLn h s hGetContents :: Handle -> IO String hGetContents h = hSetEncoding h utf8_bom >> IO.hGetContents h -#else - -import qualified Data.ByteString as B -import Data.ByteString.UTF8 (toString, fromString) -import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn) -import System.IO (Handle) -import Control.Monad (liftM) - - -bom :: B.ByteString -bom = B.pack [0xEF, 0xBB, 0xBF] - -stripBOM :: B.ByteString -> B.ByteString -stripBOM s | bom `B.isPrefixOf` s = B.drop 3 s -stripBOM s = s - -readFile :: FilePath -> IO String -readFile = liftM (toString . stripBOM) . B.readFile . encodePath - -writeFile :: FilePath -> String -> IO () -writeFile f = B.writeFile (encodePath f) . fromString - -getContents :: IO String -getContents = liftM (toString . stripBOM) B.getContents - -hGetContents :: Handle -> IO String -hGetContents h = liftM (toString . stripBOM) (B.hGetContents h) - -putStr :: String -> IO () -putStr = B.putStr . fromString - -putStrLn :: String -> IO () -putStrLn = B.putStrLn . fromString - -hPutStr :: Handle -> String -> IO () -hPutStr h = B.hPutStr h . fromString - -hPutStrLn :: Handle -> String -> IO () -hPutStrLn h s = hPutStr h (s ++ "\n") - -#endif - encodePath :: FilePath -> FilePath decodeArg :: String -> String #if MIN_VERSION_base(4,4,0) -- cgit v1.2.3