module Development.Shake.Plus.Temp (
withTempFile
, withTempDir
, withTempFileWithin
, withTempDirWithin
) where
import qualified Development.Shake
import Development.Shake.Plus.Core
import Path
import RIO hiding (withTempFile)
withTempFile :: (MonadUnliftAction m, MonadThrow m) => (Path Rel File -> m a) -> m a
withTempFile f = withRunInAction $ \run -> Development.Shake.withTempFile $ run . (f <=< parseRelFile)
withTempDir :: (MonadUnliftAction m, MonadThrow m) => (Path Rel Dir -> m a) -> m a
withTempDir f = withRunInAction $ \run -> Development.Shake.withTempDir $ run . (f <=< parseRelDir)
withTempFileWithin :: (MonadUnliftAction m, MonadThrow m) => Path b Dir -> (Path Rel File -> m a) -> m a
withTempFileWithin x f = withRunInAction $ \run -> Development.Shake.withTempFileWithin (toFilePath x) $ run . (f <=< parseRelFile)
withTempDirWithin :: (MonadUnliftAction m, MonadThrow m) => Path b Dir -> (Path Rel Dir -> m a) -> m a
withTempDirWithin x f = withRunInAction $ \run -> Development.Shake.withTempDirWithin (toFilePath x) $ run . (f <=< parseRelDir)