diff --git a/hledger-lib/Hledger/Data/Amount.hs b/hledger-lib/Hledger/Data/Amount.hs index f366ca5ae..3ee06add0 100644 --- a/hledger-lib/Hledger/Data/Amount.hs +++ b/hledger-lib/Hledger/Data/Amount.hs @@ -435,7 +435,7 @@ applyDigitGroupStyle (Just (DigitGroups c gs)) s = addseps (repeatLast gs) s where addseps [] s = s addseps (g:gs) s - | genericLength s <= toInteger g = s + | toInteger (length s) <= toInteger g = s | otherwise = let (part,rest) = genericSplitAt g s in part ++ c : addseps gs rest repeatLast [] = [] @@ -602,7 +602,7 @@ multiplyMixedAmountAndPrice n = mapMixedAmount (multiplyAmountAndPrice n) -- | Calculate the average of some mixed amounts. averageMixedAmounts :: [MixedAmount] -> MixedAmount averageMixedAmounts [] = 0 -averageMixedAmounts as = genericLength as `divideMixedAmount` sum as +averageMixedAmounts as = fromIntegral (length as) `divideMixedAmount` sum as -- | Is this mixed amount negative, if we can tell that unambiguously? -- Ie when normalised, are all individual commodity amounts negative ? diff --git a/hledger-lib/Hledger/Data/Dates.hs b/hledger-lib/Hledger/Data/Dates.hs index 469e1bd7f..4ec0d476d 100644 --- a/hledger-lib/Hledger/Data/Dates.hs +++ b/hledger-lib/Hledger/Data/Dates.hs @@ -560,8 +560,8 @@ nthdayofyearcontaining m md date | not (validDay md) = error' $ "nthdayofyearcontaining: invalid day " ++show md | mmddOfSameYear <= date = mmddOfSameYear | otherwise = mmddOfPrevYear - where mmddOfSameYear = addDays (fromIntegral md-1) $ applyN (m-1) nextmonth s - mmddOfPrevYear = addDays (fromIntegral md-1) $ applyN (m-1) nextmonth $ prevyear s + where mmddOfSameYear = addDays (toInteger md-1) $ applyN (m-1) nextmonth s + mmddOfPrevYear = addDays (toInteger md-1) $ applyN (m-1) nextmonth $ prevyear s s = startofyear date -- | For given date d find month-long interval that starts on nth day of month @@ -612,8 +612,8 @@ nthdayofmonthcontaining md date nthdayofweekcontaining :: WeekDay -> Day -> Day nthdayofweekcontaining n d | nthOfSameWeek <= d = nthOfSameWeek | otherwise = nthOfPrevWeek - where nthOfSameWeek = addDays (fromIntegral n-1) s - nthOfPrevWeek = addDays (fromIntegral n-1) $ prevweek s + where nthOfSameWeek = addDays (toInteger n-1) s + nthOfPrevWeek = addDays (toInteger n-1) $ prevweek s s = startofweek d -- | For given date d find month-long interval that starts on nth weekday of month @@ -647,9 +647,9 @@ advancetonthweekday n wd s = maybe err (addWeeks (n-1)) $ firstMatch (>=s) $ iterate (addWeeks 1) $ firstweekday s where err = error' "advancetonthweekday: should not happen" - addWeeks k = addDays (7 * fromIntegral k) + addWeeks k = addDays (7 * toInteger k) firstMatch p = headMay . dropWhile (not . p) - firstweekday = addDays (fromIntegral wd-1) . startofweek + firstweekday = addDays (toInteger wd-1) . startofweek ---------------------------------------------------------------------- -- parsing diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index f643a95fb..19407d938 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -716,7 +716,7 @@ journalBalanceTransactions assrt j' = runST $ do -- We'll update a mutable array of transactions as we balance them, -- not strictly necessary but avoids a sort at the end I think. - balancedtxns <- newListArray (1, genericLength ts) ts + balancedtxns <- newListArray (1, toInteger $ length ts) ts -- Infer missing posting amounts, check transactions are balanced, -- and check balance assertions. This is done in two passes: diff --git a/hledger-lib/Hledger/Data/Period.hs b/hledger-lib/Hledger/Data/Period.hs index 2f8d8d8af..9f7c785e7 100644 --- a/hledger-lib/Hledger/Data/Period.hs +++ b/hledger-lib/Hledger/Data/Period.hs @@ -295,7 +295,7 @@ periodShrink today (YearPeriod y) periodShrink today _ = YearPeriod y where (y,_,_) = toGregorian today -mondayBefore d = addDays (fromIntegral (1 - wd)) d +mondayBefore d = addDays (1 - toInteger wd) d where (_,_,wd) = toWeekDate d diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index d72a3d098..92e5f5eb7 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -1024,7 +1024,7 @@ data DigitGrp = DigitGrp { instance Show DigitGrp where show (DigitGrp len num) = "\"" ++ padding ++ numStr ++ "\"" where numStr = show num - padding = genericReplicate (toInteger len - genericLength numStr) '0' + padding = genericReplicate (toInteger len - toInteger (length numStr)) '0' instance Sem.Semigroup DigitGrp where DigitGrp l1 n1 <> DigitGrp l2 n2 = DigitGrp (l1 + l2) (n1 * 10^l2 + n2) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index cb004393d..4ac159743 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -779,7 +779,7 @@ tests_JournalReader = tests "JournalReader" [ bad "2011/1/1 00:00:60" bad "2011/1/1 3:5:7" -- timezone is parsed but ignored - let t = LocalTime (fromGregorian 2018 1 1) (TimeOfDay 0 0 (fromIntegral 0)) + let t = LocalTime (fromGregorian 2018 1 1) (TimeOfDay 0 0 0) assertParseEq datetimep "2018/1/1 00:00-0800" t assertParseEq datetimep "2018/1/1 00:00+1234" t diff --git a/hledger-lib/Hledger/Read/TimedotReader.hs b/hledger-lib/Hledger/Read/TimedotReader.hs index 46a868db7..44403b949 100644 --- a/hledger-lib/Hledger/Read/TimedotReader.hs +++ b/hledger-lib/Hledger/Read/TimedotReader.hs @@ -240,7 +240,7 @@ dotquantityp :: JournalParser m Quantity dotquantityp = do -- lift $ traceparse "dotquantityp" dots <- filter (not.isSpace) <$> many (oneOf (". " :: [Char])) - return $ (/4) $ fromIntegral $ length dots + return $ fromIntegral (length dots) / 4 -- | XXX new comment line parser, move to Hledger.Read.Common.emptyorcommentlinep -- Parse empty lines, all-blank lines, and lines beginning with any of the provided