From 1825dde586a3cd2e046e26b8982fb8800bddf10e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Dec 2014 21:19:51 +0100 Subject: test5: initial emergency commit --- Utils.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Utils.hs (limited to 'Utils.hs') 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 -- cgit v1.2.3