extra: fix hledger-equity, hledger-rewrite compilation

This commit is contained in:
Simon Michael 2015-05-25 08:39:50 -07:00
parent 35fb60d773
commit 5d1ea71568
2 changed files with 6 additions and 6 deletions

View File

@ -37,7 +37,7 @@ main = do
withJournalDo opts $ withJournalDo opts $
\CliOpts{reportopts_=ropts} j -> do \CliOpts{reportopts_=ropts} j -> do
today <- getCurrentDay today <- getCurrentDay
let ropts_ = ropts{flat_=True} let ropts_ = ropts{accountlistmode_=ALFlat}
q = queryFromOpts today ropts_ q = queryFromOpts today ropts_
(acctbals,_) = balanceReport ropts_ q j (acctbals,_) = balanceReport ropts_ q j
balancingamt = negate $ sum $ map (\((_,_,_),b) -> b) acctbals balancingamt = negate $ sum $ map (\((_,_,_),b) -> b) acctbals

View File

@ -1,5 +1,5 @@
#!/usr/bin/env runhaskell #!/usr/bin/env runhaskell
{-# LANGUAGE CPP #-} -- {-# LANGUAGE CPP #-}
{-| {-|
hledger-rewrite [PATTERNS] --add-posting "ACCT AMTEXPR" ... hledger-rewrite [PATTERNS] --add-posting "ACCT AMTEXPR" ...
@ -23,9 +23,9 @@ Tested-with: hledger HEAD ~ 2014/2/4
-- hledger lib, cli and cmdargs utils -- hledger lib, cli and cmdargs utils
import Hledger.Cli import Hledger.Cli
-- more utils for parsing -- more utils for parsing
#if !MIN_VERSION_base(4,8,0) -- #if !MIN_VERSION_base(4,8,0)
import Control.Applicative.Compat ((<*)) -- import Control.Applicative.Compat ((<*))
#endif -- #endif
import Text.Parsec import Text.Parsec
@ -70,7 +70,7 @@ amountexprp =
amountExprRenderer :: Query -> AmountExpr -> (Transaction -> MixedAmount) amountExprRenderer :: Query -> AmountExpr -> (Transaction -> MixedAmount)
amountExprRenderer q aex = amountExprRenderer q aex =
case aex of case aex of
AmountLiteral s -> either parseerror (const . mixed) $ runParser (amountp <* eof) nullctx "" s AmountLiteral s -> mamountp' s -- either parseerror (const . mixed) $ runParser (amountp <* eof) nullctx "" s
AmountMultiplier n -> (`divideMixedAmount` (1 / n)) . (`firstAmountMatching` q) AmountMultiplier n -> (`divideMixedAmount` (1 / n)) . (`firstAmountMatching` q)
where where
firstAmountMatching :: Transaction -> Query -> MixedAmount firstAmountMatching :: Transaction -> Query -> MixedAmount