diff --git a/bin/hledger-smooth.hs b/bin/hledger-smooth.hs index a4a3e084a..2abf5cbbf 100755 --- a/bin/hledger-smooth.hs +++ b/bin/hledger-smooth.hs @@ -105,7 +105,7 @@ splitPosting acct dates p@Posting{paccount,pamount} [d] -> (d, []) [] -> error' "splitPosting ran out of dates, should not happen (maybe sort your transactions by date)" days = initSafe [start..end] - amt = (fromIntegral $ length days) `divideMixedAmount` pamount + amt = (genericLength days) `divideMixedAmount` pamount -- give one of the postings an exact balancing amount to ensure the transaction is balanced -- lastamt = pamount - ptrace (amt `multiplyMixedAmount` (fromIntegral $ length days)) lastamt = missingmixedamt diff --git a/hledger-lib/Hledger/Data/Amount.hs b/hledger-lib/Hledger/Data/Amount.hs index 3ee06add0..6b68fbdbe 100644 --- a/hledger-lib/Hledger/Data/Amount.hs +++ b/hledger-lib/Hledger/Data/Amount.hs @@ -411,8 +411,8 @@ showamountquantity :: Amount -> String showamountquantity Amount{aquantity=q, astyle=AmountStyle{asprecision=p, asdecimalpoint=mdec, asdigitgroups=mgrps}} = punctuatenumber (fromMaybe '.' mdec) mgrps qstr where - -- isint n = fromIntegral (round n) == n - qstr -- p == maxprecision && isint q = printf "%d" (round q::Integer) + -- isint n = round n == n + qstr -- p == maxprecision && isint q = printf "%d" (round q::Integer) | p == maxprecisionwithpoint = show q | p == maxprecision = chopdotzero $ show q | otherwise = show $ roundTo p q diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 92e5f5eb7..2f5c31958 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -241,14 +241,13 @@ runErroringJournalParser p t = rejp = runErroringJournalParser genericSourcePos :: SourcePos -> GenericSourcePos -genericSourcePos p = GenericSourcePos (sourceName p) (fromIntegral . unPos $ sourceLine p) (fromIntegral . unPos $ sourceColumn p) +genericSourcePos p = GenericSourcePos (sourceName p) (unPos $ sourceLine p) (unPos $ sourceColumn p) -- | Construct a generic start & end line parse position from start and end megaparsec SourcePos's. journalSourcePos :: SourcePos -> SourcePos -> GenericSourcePos -journalSourcePos p p' = JournalSourcePos (sourceName p) (fromIntegral . unPos $ sourceLine p, fromIntegral $ line') - where line' - | (unPos $ sourceColumn p') == 1 = unPos (sourceLine p') - 1 - | otherwise = unPos $ sourceLine p' -- might be at end of file withat last new-line +journalSourcePos p p' = JournalSourcePos (sourceName p) (unPos $ sourceLine p, line') + where line' | (unPos $ sourceColumn p') == 1 = unPos (sourceLine p') - 1 + | otherwise = unPos $ sourceLine p' -- might be at end of file withat last new-line -- | Given a parser to ParsedJournal, input options, file path and -- content: run the parser on the content, and finalise the result to diff --git a/hledger-lib/Hledger/Utils/Text.hs b/hledger-lib/Hledger/Utils/Text.hs index 203dae61c..97ed80cbc 100644 --- a/hledger-lib/Hledger/Utils/Text.hs +++ b/hledger-lib/Hledger/Utils/Text.hs @@ -404,9 +404,9 @@ textWidth s = maximum $ map (T.foldr (\a b -> charWidth a + b) 0) $ T.lines s -- | Read a decimal number from a Text. Assumes the input consists only of digit -- characters. -readDecimal :: Integral a => Text -> a +readDecimal :: Text -> Integer readDecimal = foldl' step 0 . T.unpack - where step a c = a * 10 + fromIntegral (digitToInt c) + where step a c = a * 10 + toInteger (digitToInt c) tests_Text = tests "Text" [ diff --git a/hledger-ui/Hledger/UI/RegisterScreen.hs b/hledger-ui/Hledger/UI/RegisterScreen.hs index 8a474cb96..1551b2382 100644 --- a/hledger-ui/Hledger/UI/RegisterScreen.hs +++ b/hledger-ui/Hledger/UI/RegisterScreen.hs @@ -360,7 +360,7 @@ rsHandle ui@UIState{ let ts = map rsItemTransaction $ V.toList $ nonblanks numberedts = zip [1..] ts - i = fromIntegral $ maybe 0 (+1) $ elemIndex t ts -- XXX + i = maybe 0 (toInteger . (+1)) $ elemIndex t ts -- XXX in continue $ screenEnter d transactionScreen{tsTransaction=(i,t) ,tsTransactions=numberedts