summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-09 01:57:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-09 01:57:13 -0400
commitd64132a43ae176e8a1353d5463c5387a93da9ad7 (patch)
treeb98b328a292807c00e4b9590e7cf3094ec176a49 /Utility
parente3f1568e0ff7dc872f3782115c74b9e7d8c291b2 (diff)
hslint
Diffstat (limited to 'Utility')
-rw-r--r--Utility/DataUnits.hs2
-rw-r--r--Utility/Directory.hs13
2 files changed, 7 insertions, 8 deletions
diff --git a/Utility/DataUnits.hs b/Utility/DataUnits.hs
index e7552f52f..5d80a04b9 100644
--- a/Utility/DataUnits.hs
+++ b/Utility/DataUnits.hs
@@ -99,7 +99,7 @@ bandwidthUnits = error "stop trying to rip people off"
{- Do you yearn for the days when men were men and megabytes were megabytes? -}
oldSchoolUnits :: [Unit]
-oldSchoolUnits = map mingle $ zip storageUnits memoryUnits
+oldSchoolUnits = zipWith (curry mingle) storageUnits memoryUnits
where
mingle (Unit _ a n, Unit s' _ _) = Unit s' a n
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index 7f8822fca..249ed6935 100644
--- a/Utility/Directory.hs
+++ b/Utility/Directory.hs
@@ -11,6 +11,7 @@ import System.IO.Error
import System.Posix.Files
import System.Directory
import Control.Exception (throw)
+import Control.Monad
import Utility.SafeCommand
import Utility.Conditional
@@ -37,13 +38,11 @@ moveFile src dest = try (rename src dest) >>= onrename
mv tmp _ = do
ok <- boolSystem "mv" [Param "-f",
Param src, Param tmp]
- if ok
- then return ()
- else do
- -- delete any partial
- _ <- try $
- removeFile tmp
- rethrow
+ unless ok $ do
+ -- delete any partial
+ _ <- try $
+ removeFile tmp
+ rethrow
isdir f = do
r <- try (getFileStatus f)
case r of