diff options
author | tv <tv@shackspace.de> | 2014-12-28 21:19:51 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-12-28 21:19:51 +0100 |
commit | 1825dde586a3cd2e046e26b8982fb8800bddf10e (patch) | |
tree | f6a2511bc849af1008bebe61edb9137d2c431ede /Utils.hs | |
parent | 471e376a3d4a0257a2f27fa067fcb4f707cc7e6d (diff) |
test5: initial emergency commit
Diffstat (limited to 'Utils.hs')
-rw-r--r-- | Utils.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Utils.hs b/Utils.hs new file mode 100644 index 0000000..2ccf4f7 --- /dev/null +++ b/Utils.hs @@ -0,0 +1,16 @@ +module Utils where + +import Control.Exception +import Data.Monoid +import System.Directory +import System.IO + + +withTempFile :: FilePath -> String -> ((FilePath, Handle) -> IO a) -> IO a +withTempFile tmpdir template = + bracket (openTempFile tmpdir template) (removeFile . fst) + + +mintercalate :: Monoid b => b -> [b] -> b +mintercalate c (h:t) = foldl (\acc x -> acc <> c <> x) h t +mintercalate _ [] = mempty |