Open kaizhang opened 7 years ago
There is https://hackage.haskell.org/package/temporary-1.3/docs/System-IO-Temp.html#v:withTempFile
withTempFile :: (MonadIO m, MonadMask m) =>
FilePath -- ^ Parent directory to create the file in
-> String -- ^ File name template
-> (FilePath -> Handle -> m a) -- ^ Callback that can use the file
-> m a
This requires a MonadMask Sh
instance which we might not have: https://hackage.haskell.org/package/exceptions-0.10.0/docs/Control-Monad-Catch.html#t:MonadMask
A similar function is in https://hackage.haskell.org/package/unliftio-0.2.23.0/docs/UnliftIO-Temporary.html#v:withTempFile which requires instance MonadUnliftIO Sh
.
Maybe it is possible to define one of these instances for Sh
?
withTmpFile
, which is a very useful function.withTmpDir
should be able to create tmp dir under a specific location, likemktempdir
does in Turtle.Any particular reason for not having these?