mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-13 21: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user