Simplify mktemp. Fixes #98

This commit is contained in:
Gabriel Gonzalez 2015-08-23 20:16:29 -07:00
parent 681f5d3da9
commit c833de0b45
2 changed files with 4 additions and 4 deletions

View file

@ -887,14 +887,14 @@ mktemp
-- ^ Parent directory -- ^ Parent directory
-> Text -> Text
-- ^ File name template -- ^ File name template
-> Managed (FilePath, Handle) -> Managed FilePath
mktemp parent prefix = do mktemp parent prefix = do
let parent' = Filesystem.encodeString parent let parent' = Filesystem.encodeString parent
let prefix' = unpack prefix let prefix' = unpack prefix
(file', handle) <- managed (\k -> (file', handle) <- managed (\k ->
withTempFile parent' prefix' (\file' handle -> k (file', handle)) ) withTempFile parent' prefix' (\file' handle -> k (file', handle)) )
let file = Filesystem.decodeString file' liftIO (hClose handle)
return (file, handle) return (Filesystem.decodeString file')
-- | Fork a thread, acquiring an `Async` value -- | Fork a thread, acquiring an `Async` value
fork :: IO a -> Managed (Async a) fork :: IO a -> Managed (Async a)

View file

@ -1,5 +1,5 @@
Name: turtle Name: turtle
Version: 1.2.1 Version: 1.3.0
Cabal-Version: >=1.10 Cabal-Version: >=1.10
Build-Type: Simple Build-Type: Simple
License: BSD3 License: BSD3