+
+readUTF8File :: FilePath -> IO String
+readUTF8File file = do
+ h <- openFile file ReadMode
+#if __GLASGOW_HASKELL__ >= 612
+ -- fix the encoding to UTF-8
+ hSetEncoding h utf8
+#endif
+ hGetContents h
+
+-- removeFileSave doesn't throw an exceptions, if the file is already deleted
+removeFileSafe :: FilePath -> IO ()
+removeFileSafe fn =
+ removeFile fn `catch` \ e ->
+ when (not $ isDoesNotExistError e) $ ioError e
\ No newline at end of file