mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 18:29:36 +03:00
Hlint: Warning: Use :
This commit is contained in:
parent
1bac7a92af
commit
c6eac33d32
@ -251,7 +251,7 @@ accountNameAt buf lineno = accountNameFromComponents anamecomponents
|
||||
anamecomponents = reverse $ map strip $ dropsiblings thisbranch
|
||||
dropsiblings :: [AccountName] -> [AccountName]
|
||||
dropsiblings [] = []
|
||||
dropsiblings (x:xs) = [x] ++ dropsiblings xs'
|
||||
dropsiblings (x:xs) = x : dropsiblings xs'
|
||||
where
|
||||
xs' = dropWhile moreindented xs
|
||||
moreindented = (>= myindent) . indentof
|
||||
@ -278,7 +278,7 @@ currentLedgerTransaction a@AppState{aledger=l,abuf=buf} = entryContainingTransac
|
||||
t = safehead nulltxn $ filter ismatch $ ledgerTransactions l
|
||||
ismatch t = tdate t == parsedate (take 10 datedesc)
|
||||
&& take 70 (showtxn False t nullmixedamt) == (datedesc ++ acctamt)
|
||||
datedesc = take 32 $ fromMaybe "" $ find (not . (" " `isPrefixOf`)) $ [safehead "" rest] ++ reverse above
|
||||
datedesc = take 32 $ fromMaybe "" $ find (not . (" " `isPrefixOf`)) $ safehead "" rest : reverse above
|
||||
acctamt = drop 32 $ safehead "" rest
|
||||
safehead d ls = if null ls then d else head ls
|
||||
(above,rest) = splitAt y buf
|
||||
|
@ -47,7 +47,7 @@ parentAccountNames :: AccountName -> [AccountName]
|
||||
parentAccountNames a = parentAccountNames' $ parentAccountName a
|
||||
where
|
||||
parentAccountNames' "" = []
|
||||
parentAccountNames' a = [a] ++ parentAccountNames' (parentAccountName a)
|
||||
parentAccountNames' a = a : parentAccountNames' (parentAccountName a)
|
||||
|
||||
isAccountNamePrefixOf :: AccountName -> AccountName -> Bool
|
||||
isAccountNamePrefixOf = isPrefixOf . (++ [acctsepchar])
|
||||
|
@ -128,7 +128,7 @@ punctuatethousands s =
|
||||
(int,frac) = break (=='.') num
|
||||
addcommas = reverse . concat . intersperse "," . triples . reverse
|
||||
triples [] = []
|
||||
triples l = [take 3 l] ++ triples (drop 3 l)
|
||||
triples l = take 3 l : triples (drop 3 l)
|
||||
|
||||
-- | Does this amount appear to be zero when displayed with its given precision ?
|
||||
isZeroAmount :: Amount -> Bool
|
||||
|
@ -60,8 +60,8 @@ splitspan start next span@(DateSpan (Just b) (Just e))
|
||||
where
|
||||
splitspan' start next (DateSpan (Just b) (Just e))
|
||||
| b >= e = []
|
||||
| otherwise = [DateSpan (Just s) (Just n)]
|
||||
++ splitspan' start next (DateSpan (Just n) (Just e))
|
||||
| otherwise = DateSpan (Just s) (Just n)
|
||||
: splitspan' start next (DateSpan (Just n) (Just e))
|
||||
where s = start b
|
||||
n = next s
|
||||
splitspan' _ _ _ = error "won't happen, avoids warnings"
|
||||
|
@ -68,7 +68,7 @@ showLedgerTransaction' elide effective t =
|
||||
| otherwise = showdate (ltdate t) ++ maybe "" showedate (lteffectivedate t)
|
||||
status = if ltstatus t then " *" else ""
|
||||
code = if length (ltcode t) > 0 then printf " (%s)" $ ltcode t else ""
|
||||
desc = " " ++ ltdescription t
|
||||
desc = ' ' : ltdescription t
|
||||
showdate = printf "%-10s" . showDate
|
||||
showedate = printf "=%s" . showdate
|
||||
showpostings ps
|
||||
|
@ -38,7 +38,7 @@ instance Read TimeLogCode where
|
||||
entriesFromTimeLogEntries :: LocalTime -> [TimeLogEntry] -> [LedgerTransaction]
|
||||
entriesFromTimeLogEntries _ [] = []
|
||||
entriesFromTimeLogEntries now [i]
|
||||
| odate > idate = [entryFromTimeLogInOut i o'] ++ entriesFromTimeLogEntries now [i',o]
|
||||
| odate > idate = entryFromTimeLogInOut i o' : entriesFromTimeLogEntries now [i',o]
|
||||
| otherwise = [entryFromTimeLogInOut i o]
|
||||
where
|
||||
o = TimeLogEntry Out end ""
|
||||
@ -48,8 +48,8 @@ entriesFromTimeLogEntries now [i]
|
||||
o' = o{tldatetime=itime{localDay=idate, localTimeOfDay=TimeOfDay 23 59 59}}
|
||||
i' = i{tldatetime=itime{localDay=addDays 1 idate, localTimeOfDay=midnight}}
|
||||
entriesFromTimeLogEntries now (i:o:rest)
|
||||
| odate > idate = [entryFromTimeLogInOut i o'] ++ entriesFromTimeLogEntries now (i':o:rest)
|
||||
| otherwise = [entryFromTimeLogInOut i o] ++ entriesFromTimeLogEntries now rest
|
||||
| odate > idate = entryFromTimeLogInOut i o' : entriesFromTimeLogEntries now (i':o:rest)
|
||||
| otherwise = entryFromTimeLogInOut i o : entriesFromTimeLogEntries now rest
|
||||
where
|
||||
(itime,otime) = (tldatetime i,tldatetime o)
|
||||
(idate,odate) = (localDay itime,localDay otime)
|
||||
|
@ -28,9 +28,9 @@ binaryfilename = prettify $ splitAtElement '.' buildversion :: String
|
||||
where
|
||||
bugfix'
|
||||
| bugfix `elem` ["0"{-,"98","99"-}] = ""
|
||||
| otherwise = "."++bugfix
|
||||
| otherwise = '.' : bugfix
|
||||
patches'
|
||||
| patches/="0" = "+"++patches
|
||||
| patches/="0" = '+' : patches
|
||||
| otherwise = ""
|
||||
(os',suffix)
|
||||
| os == "darwin" = ("mac","")
|
||||
@ -49,7 +49,7 @@ versionstr = prettify $ splitAtElement '.' buildversion :: String
|
||||
where
|
||||
bugfix'
|
||||
| bugfix `elem` ["0"{-,"98","99"-}] = ""
|
||||
| otherwise = "."++bugfix
|
||||
| otherwise = '.' : bugfix
|
||||
patches'
|
||||
| patches/="0" = "+"++patches
|
||||
| otherwise = ""
|
||||
|
@ -112,7 +112,7 @@ parseargs as =
|
||||
|
||||
optValueWithDefault :: (String -> Opt) -> String -> [Opt] -> String
|
||||
optValueWithDefault optcons def opts =
|
||||
last $ [def] ++ optValuesForConstructor optcons opts
|
||||
last $ def : optValuesForConstructor optcons opts
|
||||
|
||||
optValuesForConstructor :: (String -> Opt) -> [Opt] -> [String]
|
||||
optValuesForConstructor optcons opts = concatMap get opts
|
||||
|
@ -76,7 +76,7 @@ doctests s = filter isDocTest $ haddockLiterals s
|
||||
haddockLiterals :: String -> [String]
|
||||
haddockLiterals "" = []
|
||||
haddockLiterals s | null lit = []
|
||||
| otherwise = [lit] ++ haddockLiterals rest
|
||||
| otherwise = lit : haddockLiterals rest
|
||||
where
|
||||
ls = drop 1 $ dropWhile (not . isLiteralBoundary) $ lines s
|
||||
lit = unlines $ takeWhile (not . isLiteralBoundary) ls
|
||||
|
@ -45,7 +45,7 @@ uniqueacctnames' depth uniquenames = group some ++ uniqueacctnames' depth rest
|
||||
-- group ["a", "b", "c"] = ["a","a:b","a:b:c"]
|
||||
group :: [String] -> [String]
|
||||
group [] = []
|
||||
group (a:as) = [a] ++ map ((a++":")++) (group as)
|
||||
group (a:as) = a : map ((a++":")++) (group as)
|
||||
|
||||
pair :: [a] -> [(a,a)]
|
||||
pair [] = []
|
||||
|
Loading…
Reference in New Issue
Block a user