mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-27 05:22:50 -06:00
cleanup
Simplify the implementation of writeUTF8File and use it in one more place. Remove unused imports left over after a previous change.
This commit is contained in:
@@ -188,16 +188,14 @@ putPointE v opts msg act = do
|
||||
-- * File IO
|
||||
|
||||
writeUTF8File :: FilePath -> String -> IO ()
|
||||
writeUTF8File fpath content = do
|
||||
h <- openFile fpath WriteMode
|
||||
hSetEncoding h utf8
|
||||
hPutStr h content
|
||||
hClose h
|
||||
writeUTF8File fpath content =
|
||||
withFile fpath WriteMode $ \ h -> do hSetEncoding h utf8
|
||||
hPutStr h content
|
||||
|
||||
readBinaryFile path = hGetContents =<< openBinaryFile path ReadMode
|
||||
writeBinaryFile path s = withBinaryFile path WriteMode (flip hPutStr s)
|
||||
|
||||
-- Because GHC adds the confusing text "user error" for failures cased by
|
||||
-- | Because GHC adds the confusing text "user error" for failures caused by
|
||||
-- calls to fail.
|
||||
ioErrorText e = if isUserError e
|
||||
then ioeGetErrorString e
|
||||
|
||||
Reference in New Issue
Block a user