factor out utility function
This commit is contained in:
parent
fd7e9431ff
commit
fd1382f96f
2 changed files with 9 additions and 7 deletions
|
@ -40,6 +40,13 @@ readFileStrictAnyEncoding f = withFile f ReadMode $ \h -> do
|
|||
fileEncoding h
|
||||
hClose h `after` hGetContentsStrict h
|
||||
|
||||
{- Writes a file, using the FileSystemEncoding so it will never crash
|
||||
- on a badly encoded content string. -}
|
||||
writeFileAnyEncoding :: FilePath -> String -> IO ()
|
||||
writeFileAnyEncoding f content = withFile f WriteMode $ \h -> do
|
||||
fileEncoding h
|
||||
hPutStr h content
|
||||
|
||||
{- Like break, but the item matching the condition is not included
|
||||
- in the second result list.
|
||||
-
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue