diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 4a0b9cdfc..5e4fa9f04 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -732,7 +732,6 @@ addOrAssignAmountAndCheckAssertionB p@Posting{paccount=acc, pamount=amt, pbalanc newbal <- addAmountB acc amt whenM (R.reader bsAssrt) $ checkBalanceAssertionB p newbal return p - | Nothing <- mba = return p | Just BalanceAssertion{baamount,batotal} <- mba = do (diff,newbal) <- case batotal of True -> do @@ -750,6 +749,8 @@ addOrAssignAmountAndCheckAssertionB p@Posting{paccount=acc, pamount=amt, pbalanc let p' = p{pamount=diff, poriginal=Just $ originalPosting p} whenM (R.reader bsAssrt) $ checkBalanceAssertionB p' newbal return p' + -- no amount, no balance assertion (GHC 7 doesn't like Nothing <- mba here) + | otherwise = return p -- | Add the posting's amount to its account's running balance, and -- optionally check the posting's balance assertion if any. diff --git a/hledger-web/Hledger/Web/Json.hs b/hledger-web/Hledger/Web/Json.hs index c71726652..97d7250fb 100644 --- a/hledger-web/Hledger/Web/Json.hs +++ b/hledger-web/Hledger/Web/Json.hs @@ -120,7 +120,7 @@ instance FromJSON Account -- https://github.com/PaulJohnson/Haskell-Decimal/issues/6 --deriving instance Generic Decimal --instance FromJSON Decimal -deriving instance Generic (DecimalRaw Integer) +deriving instance Generic (DecimalRaw a) instance FromJSON (DecimalRaw Integer) -- -- @simonmichael, I think the code in your first comment should work if it compiles—though “work” doesn’t mean you can parse a JSON number directly into a `Decimal` using the generic instance, as you’ve discovered.