lib, web: tweaks to keep building with GHC 7

This commit is contained in:
Simon Michael 2019-03-01 15:07:17 -08:00
parent 6becbc78f3
commit 16157bc711
2 changed files with 3 additions and 2 deletions

View File

@ -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.

View File

@ -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” doesnt mean you can parse a JSON number directly into a `Decimal` using the generic instance, as youve discovered.