git.iko.soy/typeable/pandoc
on master help sign in
Removed unneeded CPP conditional.
3110774John MacFarlane
src/Text/Pandoc/UTF8.hs−44
@@ -46,8 +46,6 @@ where
46import Codec.Binary.UTF8.String (encodeString, decodeString)
46import Codec.Binary.UTF8.String (encodeString, decodeString)
47#endif
47#endif
48
48
49−#if MIN_VERSION_base(4,2,0)
50−
51import System.IO hiding (readFile, writeFile, getContents,
49import System.IO hiding (readFile, writeFile, getContents,
52 putStr, putStrLn, hPutStr, hPutStrLn, hGetContents)
50 putStr, putStrLn, hPutStr, hPutStrLn, hGetContents)
53import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn )
51import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn )
@@ -79,48 +77,6 @@ hPutStrLn h s = hSetEncoding h utf8 >> IO.hPutStrLn h s
79hGetContents :: Handle -> IO String
77hGetContents :: Handle -> IO String
80hGetContents h = hSetEncoding h utf8_bom >> IO.hGetContents h
78hGetContents h = hSetEncoding h utf8_bom >> IO.hGetContents h
81
79
82−#else
83−
84−import qualified Data.ByteString as B
85−import Data.ByteString.UTF8 (toString, fromString)
86−import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn)
87−import System.IO (Handle)
88−import Control.Monad (liftM)
89−
90−
91−bom :: B.ByteString
92−bom = B.pack [0xEF, 0xBB, 0xBF]
93−
94−stripBOM :: B.ByteString -> B.ByteString
95−stripBOM s | bom `B.isPrefixOf` s = B.drop 3 s
96−stripBOM s = s
97−
98−readFile :: FilePath -> IO String
99−readFile = liftM (toString . stripBOM) . B.readFile . encodePath
100−
101−writeFile :: FilePath -> String -> IO ()
102−writeFile f = B.writeFile (encodePath f) . fromString
103−
104−getContents :: IO String
105−getContents = liftM (toString . stripBOM) B.getContents
106−
107−hGetContents :: Handle -> IO String
108−hGetContents h = liftM (toString . stripBOM) (B.hGetContents h)
109−
110−putStr :: String -> IO ()
111−putStr = B.putStr . fromString
112−
113−putStrLn :: String -> IO ()
114−putStrLn = B.putStrLn . fromString
115−
116−hPutStr :: Handle -> String -> IO ()
117−hPutStr h = B.hPutStr h . fromString
118−
119−hPutStrLn :: Handle -> String -> IO ()
120−hPutStrLn h s = hPutStr h (s ++ "\n")
121−
122−#endif
123−
124encodePath :: FilePath -> FilePath
80encodePath :: FilePath -> FilePath
125decodeArg :: String -> String
81decodeArg :: String -> String
126#if MIN_VERSION_base(4,4,0)
82#if MIN_VERSION_base(4,4,0)