writeAllFile :: (PosixLike m, PosixOutStr s) => FilePath -> s -> m ()
writeAllFile fp s = bracket open closeFd (flip write $ toByteString s)
  where
    open = openFd fp WriteOnly (Just ownerRWMode) fileFlags
    ownerRWMode = P.ownerReadMode `P.unionFileModes` P.ownerWriteMode
    fileFlags = defaultFileFlags { trunc = True }

-- $outstr
-- Use these in place of 'putStr' and 'putStrLn', (as well as
-- 'hPutStr' and 'hPutStrLn').
-- Note that these are unbuffered.

-- | String like classes that can be used with 'outStr' and friends.
writeAllFile :: (PosixLike m, PosixOutStr s) => FilePath -> s -> m ()
writeAllFile fp s = bracket open closeFd (flip write $ toByteString s)
  where
    open = openFd fp WriteOnly (Just ownerRWMode) fileFlags
    ownerRWMode = P.ownerReadMode `P.unionFileModes` P.ownerWriteMode
    fileFlags = defaultFileFlags { trunc = True }

-- $outstr
-- Use these in place of 'putStr' and 'putStrLn', (as well as
-- 'hPutStr' and 'hPutStrLn').
-- Note that these are unbuffered.

-- | String like classes that can be used with 'outStr' and friends.
writeAllFile fp s = bracket open closeFd (flip write $ toByteString s)
  where
    open = openFd fp WriteOnly (Just ownerRWMode) fileFlags
    ownerRWMode = P.ownerReadMode `P.unionFileModes` P.ownerWriteMode
    fileFlags = defaultFileFlags { trunc = True }

-- $outstr
-- Use these in place of 'putStr' and 'putStrLn', (as well as
-- 'hPutStr' and 'hPutStrLn').
-- Note that these are unbuffered.

-- | String like classes that can be used with 'outStr' and friends.