+writeBinaryFileAtomic :: Bin.Binary a => FilePath -> a -> IO ()
+writeBinaryFileAtomic targetFile obj =
+ withFileAtomic targetFile $ \h -> do
+ hSetBinaryMode h True
+ B.hPutStr h (Bin.encode obj)
+
+writeFileAtomic :: FilePath -> TextEncoding -> String -> IO ()
+writeFileAtomic targetFile encoding content =
+ withFileAtomic targetFile $ \h -> do
+ hSetEncoding h encoding
+ hPutStr h content
+