Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone



Do things with files.




requireWritable :: IO.FilePath -> IO.IO () Source #

Throw if this file exists but isn't writable.

writable :: IO.FilePath -> IO.IO Bool Source #

True if the file doesn't exist, or if it does but is writable.


list :: IO.FilePath -> IO.IO [IO.FilePath] Source #

Like Directory.listDirectory except prepend the directory.


readGz :: IO.FilePath -> IO.IO (Either String ByteString.ByteString) Source #

Read and decompress a gzipped file.

writeGz Source #


:: Int

save this many previous versions of the file

-> IO.FilePath 
-> ByteString.ByteString 
-> IO.IO Bool

False if the file wasn't written because it wouldn't have changed.

Write a gzipped file. Try to do so atomically by writing to a tmp file first and renaming it.

Like mv, this will refuse to overwrite a file if it isn't writable. If the file wouldn't have changed, abort the write and delete the tmp file. The mtime won't change, and the caller gets a False, which can be used to avoid rebuilds.

IO errors

ignoreEnoent :: IO.IO a -> IO.IO (Maybe a) Source #

If op raised ENOENT, return Nothing.

ignoreIOError :: IO.IO a -> IO.IO (Maybe a) Source #

Ignore all IO errors. This is useful when you want to see if a file exists, because some-file/x will not give ENOENT, but ENOTDIR, which is probably isIllegalOperation.

ignoreError :: Exception e => (e -> Bool) -> IO.IO a -> IO.IO (Maybe a) Source #

tryIO :: IO.IO a -> IO.IO (Either IO.Error.IOError a) Source #

try specialized to IOError.