hledger-iadd 1.3.14 → 1.3.15
raw patch · 6 files changed
+24/−18 lines, 6 filesdep −semigroupsdep ~basedep ~hledger-libdep ~megaparsecPVP ok
version bump matches the API change (PVP)
Dependencies removed: semigroups
Dependency ranges changed: base, hledger-lib, megaparsec
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- README.md +3/−1
- hledger-iadd.cabal +7/−8
- src/Model.hs +6/−6
- tests/AmountParserSpec.hs +1/−1
- tests/ModelSpec.hs +2/−2
ChangeLog.md view
@@ -1,3 +1,8 @@+# 1.3.15 [2021-07-08]++ - dependencies: Support (and require) hledger-lib-1.22+ - dependencies: Drop support for GHC <8.6 completely+ # 1.3.14 [2021-03-13] - bugfix: Fix test failures
README.md view
@@ -34,7 +34,7 @@ The easiest method would be [stack]: Install the [stack] program and type: - stack install --resolver=lts hledger-iadd-1.3.9+ stack install --resolver=lts hledger-iadd-1.3.14 This downloads and builds `hledger-iadd` and all it's Haskell dependencies. After that, it copys the resulting binary to@@ -95,6 +95,8 @@ cabal copy ## Usage++*[YouTube video demonstrating basic interactions](https://www.youtube.com/watch?v=ZuCT9EzryaI)* You can start the program either with
hledger-iadd.cabal view
@@ -1,5 +1,5 @@ name: hledger-iadd-version: 1.3.14+version: 1.3.15 synopsis: A terminal UI as drop-in replacement for hledger add description: This is a terminal UI as drop-in replacement for hledger add. .@@ -59,8 +59,8 @@ , Brick.Widgets.Border.Utils , Data.Time.Ext default-language: Haskell2010- build-depends: base >= 4.9 && < 5- , hledger-lib >= 1.21 && < 1.22+ build-depends: base >= 4.12 && < 5+ , hledger-lib >= 1.22 && < 1.23 , brick >= 0.27 , vty >= 5.4 , text@@ -77,7 +77,6 @@ , xdg-basedir , unordered-containers , free >= 4.12.4- , semigroups >= 0.5.0 ghc-options: -Wall -fdefer-typed-holes -fno-warn-name-shadowing executable hledger-iadd@@ -85,9 +84,9 @@ main-is: Main.hs other-modules: Paths_hledger_iadd default-language: Haskell2010- build-depends: base >= 4.9 && < 5+ build-depends: base >= 4.12 && < 5 , hledger-iadd- , hledger-lib >= 1.21 && < 1.22+ , hledger-lib >= 1.22 && < 1.23 , brick >= 0.27 , vty >= 5.4 , text@@ -113,9 +112,9 @@ , AmountParserSpec , ModelSpec default-language: Haskell2010- build-depends: base >= 4.9 && < 5+ build-depends: base >= 4.12 && < 5 , hledger-iadd- , hledger-lib >= 1.21 && < 1.22+ , hledger-lib >= 1.22 && < 1.23 , text , transformers >= 0.3 , time >= 1.5
src/Model.hs view
@@ -269,7 +269,7 @@ cmpPosting a b = HL.paccount a == HL.paccount b && cmpAmount (HL.pamount a) (HL.pamount b) - cmpAmount (HL.Mixed a) (HL.Mixed b) = ((==) `on` map (HL.acommodity &&& HL.aquantity)) a b+ cmpAmount a b = ((==) `on` map (HL.acommodity &&& HL.aquantity)) (HL.amounts a) (HL.amounts b) listToMaybe' :: [a] -> Maybe [a] listToMaybe' [] = Nothing@@ -280,7 +280,7 @@ -- | Returns True if all postings balance and the transaction is not empty transactionBalanced :: HL.Transaction -> Bool-transactionBalanced = HL.isTransactionBalanced Nothing+transactionBalanced = HL.isTransactionBalanced HL.balancingOpts -- | Computes the sum of all postings in the transaction and inverts it negativeAmountSum :: HL.Transaction -> HL.MixedAmount@@ -371,13 +371,13 @@ -- | Compare two mixed amounts by first sorting the individual amounts -- deterministically and then comparing them one-by-one. cmpMixedAmount :: HL.MixedAmount -> HL.MixedAmount -> Ordering- cmpMixedAmount (HL.Mixed as1) (HL.Mixed as2) =+ cmpMixedAmount as1 as2 = let- sortedAs1 = sortBy cmpAmount as1- sortedAs2 = sortBy cmpAmount as2+ sortedAs1 = sortBy cmpAmount $ HL.amounts as1+ sortedAs2 = sortBy cmpAmount $ HL.amounts as2 in mconcat $- compare (length as1) (length as2) : zipWith cmpAmount sortedAs1 sortedAs2+ compare (length $ HL.amounts as1) (length $ HL.amounts as2) : zipWith cmpAmount sortedAs1 sortedAs2 cmpBalanceAssertion :: HL.BalanceAssertion -> HL.BalanceAssertion -> Ordering cmpBalanceAssertion = lexical [cmp HL.baamount, cmp HL.batotal]
tests/AmountParserSpec.hs view
@@ -34,7 +34,7 @@ parseAmount HL.nulljournal "23 +" `shouldSatisfy` isLeft amount :: Text -> HL.MixedAmount-amount = HL.mixed . pure . fromRight . runIdentity . runParserT (evalStateT HL.amountp HL.nulljournal) ""+amount = HL.mixed . Just . fromRight . runIdentity . runParserT (evalStateT HL.amountp HL.nulljournal) "" fromRight :: Either a b -> b fromRight = either (error "fromRight: Left value encountered") id
tests/ModelSpec.hs view
@@ -198,8 +198,8 @@ a2 = (HL.eur 0.5) { HL.astyle = HL.amountstyle { HL.asprecision = HL.Precision 15 } } p1 = mkPosting ("Test", -1)- p2 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.Mixed [a1] }- p3 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.Mixed [a2] }+ p2 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.mixedAmount a1 }+ p3 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.mixedAmount a2 } t0 = mkTransaction ((2017,9,23), "Test", []) t1 = t0 { HL.tpostings = [p1,p2,p2] }