diff options
author | Joey Hess <joey@kitenet.net> | 2011-07-15 12:47:14 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-07-15 12:47:14 -0400 |
commit | 6c396a256c93464d726c66a95132536941871ee8 (patch) | |
tree | 7f934c9eae22a9cfd3fb1672ebd7bf6870439c81 /Utility | |
parent | 185f0b687081f47d059cc0503f4f6b671868f753 (diff) |
finished hlint pass
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/CopyFile.hs | 12 | ||||
-rw-r--r-- | Utility/DataUnits.hs | 6 | ||||
-rw-r--r-- | Utility/Dot.hs | 10 | ||||
-rw-r--r-- | Utility/RsyncFile.hs | 2 |
4 files changed, 14 insertions, 16 deletions
diff --git a/Utility/CopyFile.hs b/Utility/CopyFile.hs index 5ee4a91df..2e06dd92b 100644 --- a/Utility/CopyFile.hs +++ b/Utility/CopyFile.hs @@ -20,10 +20,8 @@ copyFile src dest = do removeFile dest boolSystem "cp" [params, File src, File dest] where - params = if SysConfig.cp_reflink_auto - then Params "--reflink=auto" - else if SysConfig.cp_a - then Params "-a" - else if SysConfig.cp_p - then Params "-p" - else Params "" + params + | SysConfig.cp_reflink_auto = Params "--reflink=auto" + | SysConfig.cp_a = Params "-a" + | SysConfig.cp_p = Params "-p" + | otherwise = Params "" diff --git a/Utility/DataUnits.hs b/Utility/DataUnits.hs index 7af2eadaf..f2bc333ea 100644 --- a/Utility/DataUnits.hs +++ b/Utility/DataUnits.hs @@ -106,7 +106,7 @@ oldSchoolUnits = map mingle $ zip storageUnits memoryUnits {- approximate display of a particular number of bytes -} roughSize :: [Unit] -> Bool -> ByteSize -> String roughSize units abbrev i - | i < 0 = "-" ++ findUnit units' (negate i) + | i < 0 = '-' : findUnit units' (negate i) | otherwise = findUnit units' i where units' = reverse $ sort units -- largest first @@ -139,10 +139,10 @@ readSize :: [Unit] -> String -> Maybe ByteSize readSize units input | null parsednum = Nothing | null parsedunit = Nothing - | otherwise = Just $ round $ number * (fromIntegral multiplier) + | otherwise = Just $ round $ number * fromIntegral multiplier where (number, rest) = head parsednum - multiplier = head $ parsedunit + multiplier = head parsedunit unitname = takeWhile isAlpha $ dropWhile isSpace rest parsednum = reads input :: [(Double, String)] diff --git a/Utility/Dot.hs b/Utility/Dot.hs index 869684996..83f52a3cc 100644 --- a/Utility/Dot.hs +++ b/Utility/Dot.hs @@ -20,13 +20,13 @@ graphNode nodeid desc = label desc $ quote nodeid {- an edge between two nodes -} graphEdge :: String -> String -> Maybe String -> String -graphEdge fromid toid desc = indent $ maybe edge (\d -> label d edge) desc +graphEdge fromid toid desc = indent $ maybe edge (`label` edge) desc where edge = quote fromid ++ " -> " ++ quote toid {- adds a label to a node or edge -} label :: String -> String -> String -label l s = attr "label" l s +label = attr "label" {- adds an attribute to a node or edge - (can be called multiple times for multiple attributes) -} @@ -35,7 +35,7 @@ attr a v s = s ++ " [ " ++ a ++ "=" ++ quote v ++ " ]" {- fills a node with a color -} fillColor :: String -> String -> String -fillColor color s = attr "fillcolor" color $ attr "style" "filled" $ s +fillColor color s = attr "fillcolor" color $ attr "style" "filled" s {- apply to graphNode to put the node in a labeled box -} subGraph :: String -> String -> String -> String -> String @@ -52,10 +52,10 @@ subGraph subid l color s = setlabel = "label=" ++ quote l setfilled = "style=" ++ quote "filled" setcolor = "fillcolor=" ++ quote color - ii x = (indent $ indent x) ++ "\n" + ii x = indent (indent x) ++ "\n" indent ::String -> String -indent s = "\t" ++ s +indent s = '\t' : s quote :: String -> String quote s = "\"" ++ s' ++ "\"" diff --git a/Utility/RsyncFile.hs b/Utility/RsyncFile.hs index c68909d2d..6e21ba063 100644 --- a/Utility/RsyncFile.hs +++ b/Utility/RsyncFile.hs @@ -19,7 +19,7 @@ rsyncShell command = [Param "-e", Param $ unwords $ map escape (toCommand comman {- rsync requires some weird, non-shell like quoting in - here. A doubled single quote inside the single quoted - string is a single quote. -} - escape s = "'" ++ (join "''" $ split "'" s) ++ "'" + escape s = "'" ++ join "''" (split "'" s) ++ "'" {- Runs rsync in server mode to send a file, and exits. -} rsyncServerSend :: FilePath -> IO () |