samesymbol cleanup

This commit is contained in:
Simon Michael 2008-11-08 22:49:14 +00:00
parent 7819abd80f
commit 8939c1f7b7

View File

@ -100,10 +100,9 @@ canonicaliseAmounts l@(RawLedger ms ps es f) = RawLedger ms ps (map fixEntryAmou
commoditieswithsymbol s = fromMaybe (error $ "no such commodity "++s) (Map.lookup s commoditiesmap) commoditieswithsymbol s = fromMaybe (error $ "no such commodity "++s) (Map.lookup s commoditiesmap)
where where
commoditiesmap :: Map.Map String [Commodity] commoditiesmap :: Map.Map String [Commodity]
commoditiesmap = Map.fromList [(symbol $ head cs,cs) | commoditiesmap = Map.fromList [(symbol $ head cs,cs) |
cs <- groupBy samesymbol $ rawLedgerCommodities l] cs <- groupBy samesymbol $ rawLedgerCommodities l]
samesymbol :: Commodity -> Commodity -> Bool samesymbol c1 c2 = symbol c1 == symbol c2
samesymbol (Commodity{symbol=s1}) (Commodity{symbol=s2}) = s1==s2
rawLedgerAmounts :: RawLedger -> [MixedAmount] rawLedgerAmounts :: RawLedger -> [MixedAmount]
rawLedgerAmounts = map amount . rawLedgerTransactions rawLedgerAmounts = map amount . rawLedgerTransactions