From bb93e18ec17a49be1c91d0890d1eb8b21d854950 Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 23 Oct 2012 11:48:23 +0000 Subject: cleanup Simplify the implementation of writeUTF8File and use it in one more place. Remove unused imports left over after a previous change. --- src/compiler/GFC.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/compiler/GFC.hs') diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs index 72a986303..6dc891679 100644 --- a/src/compiler/GFC.hs +++ b/src/compiler/GFC.hs @@ -117,11 +117,7 @@ grammarName opts pgf = fromMaybe (showCId (absname pgf)) (flag optName opts) writeOutput :: Options -> FilePath-> String -> IOE () writeOutput opts file str = - do let path = case flag optOutputDir opts of - Nothing -> file - Just dir -> dir file - putPointE Normal opts ("Writing " ++ path ++ "...") $ ioeIO $ - bracket - (openFile path WriteMode) - (hClose) - (\h -> hSetEncoding h utf8 >> hPutStr h str) + putPointE Normal opts ("Writing " ++ path ++ "...") $ ioeIO $ + writeUTF8File path str + where + path = maybe id () (flag optOutputDir opts) file -- cgit v1.2.3