summaryrefslogtreecommitdiffstats
path: root/Utils.hs
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-28 21:19:51 +0100
committertv <tv@shackspace.de>2014-12-28 21:19:51 +0100
commit1825dde586a3cd2e046e26b8982fb8800bddf10e (patch)
treef6a2511bc849af1008bebe61edb9137d2c431ede /Utils.hs
parent471e376a3d4a0257a2f27fa067fcb4f707cc7e6d (diff)
test5: initial emergency commit
Diffstat (limited to 'Utils.hs')
-rw-r--r--Utils.hs16
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