Safe Haskell | None |
---|---|
Language | Haskell2010 |
Temporary file and directory support.
Strongly inspired by/stolen from the https://github.com/feuerbach/temporary package.
Since: unliftio-0.1.0.0
Synopsis
- withSystemTempFile :: MonadUnliftIO m => String -> (FilePath -> Handle -> m a) -> m a
- withSystemTempDirectory :: MonadUnliftIO m => String -> (FilePath -> m a) -> m a
- withTempFile :: MonadUnliftIO m => FilePath -> String -> (FilePath -> Handle -> m a) -> m a
- withTempDirectory :: MonadUnliftIO m => FilePath -> String -> (FilePath -> m a) -> m a
Documentation
:: MonadUnliftIO m | |
=> String | File name template. See |
-> (FilePath -> Handle -> m a) | Callback that can use the file |
-> m a |
Create and use a temporary file in the system standard temporary directory.
Behaves exactly the same as withTempFile
, except that the parent temporary directory
will be that returned by getCanonicalTemporaryDirectory
.
Since: unliftio-0.1.0.0
withSystemTempDirectory Source #
:: MonadUnliftIO m | |
=> String | Directory name template. See |
-> (FilePath -> m a) | Callback that can use the directory. |
-> m a |
Create and use a temporary directory in the system standard temporary directory.
Behaves exactly the same as withTempDirectory
, except that the parent temporary directory
will be that returned by getCanonicalTemporaryDirectory
.
Since: unliftio-0.1.0.0
:: MonadUnliftIO m | |
=> FilePath | Temp dir to create the file in. |
-> String | File name template. See |
-> (FilePath -> Handle -> m a) | Callback that can use the file. |
-> m a |
Use a temporary filename that doesn't already exist.
Creates a new temporary file inside the given directory, making use of the template. The temp file is deleted after use. For example:
withTempFile "src" "sdist." $ \tmpFile hFile -> do ...
The tmpFile
will be file in the given directory, e.g.
src/sdist.342
.
Since: unliftio-0.1.0.0
:: MonadUnliftIO m | |
=> FilePath | Temp directory to create the directory in. |
-> String | Directory name template. See |
-> (FilePath -> m a) | Callback that can use the directory. |
-> m a |
Create and use a temporary directory.
Creates a new temporary directory inside the given directory, making use of the template. The temp directory is deleted after use. For example:
withTempDirectory "src" "sdist." $ \tmpDir -> do ...
The tmpDir
will be a new subdirectory of the given directory, e.g.
src/sdist.342
.
Since: unliftio-0.1.0.0