{ by_account :: By_Account
, by_unit :: By_Unit
} deriving (Data, Eq, Read, Show, Typeable)
-type By_Account
- = Map Account Sum_by_Account
-type By_Unit
- = Map Amount.Unit Sum_by_Unit
-
--- | A sum by 'Account' of the 'Amount's of some 'Posting's.
-type Sum_by_Account
+type By_Account
+ = Map Account Account_Sum
+-- | A sum of 'Amount's,
+-- concerning a single 'Account'.
+type Account_Sum
= Amount.By_Unit
--- | A sum by 'Unit' of the 'Amount's of some 'Posting's,
--- with the 'Account's involved to build that sum.
-data Sum_by_Unit
- = Sum_by_Unit
- { accounts :: Map Account () -- ^ The 'Account's involved to build 'amount'.
- , amount :: Amount -- ^ The sum of 'Amount's for a same 'Unit'.
+type By_Unit
+ = Map Amount.Unit Unit_Sum
+-- | A sum of 'Amount's with their 'Account's involved,
+-- concerning a single 'Unit'.
+data Unit_Sum
+ = Unit_Sum
+ { amount :: Amount -- ^ The sum of 'Amount's for a single 'Unit'.
+ , accounts :: Map Account () -- ^ The 'Account's involved to build 'amount'.
} deriving (Data, Eq, Read, Show, Typeable)
-- ** Constructors
nil_By_Unit =
Data.Map.empty
-nil_Sum_by_Account :: Sum_by_Account
+nil_Sum_by_Account :: Account_Sum
nil_Sum_by_Account =
Data.Map.empty
-nil_Sum_by_Unit :: Sum_by_Unit
+nil_Sum_by_Unit :: Unit_Sum
nil_Sum_by_Unit =
- Sum_by_Unit
+ Unit_Sum
{ accounts = Data.Map.empty
, amount = Amount.nil
}
--- | Return a tuple associating the given 'Sum_by_Unit' with its 'Unit'.
-assoc_by_amount_unit :: Sum_by_Unit -> (Unit, Sum_by_Unit)
-assoc_by_amount_unit s = (Amount.unit $ amount s, s)
+-- | Return a tuple associating the given 'Unit_Sum' with its 'Unit'.
+assoc_unit_sum :: Unit_Sum -> (Unit, Unit_Sum)
+assoc_unit_sum s = (Amount.unit $ amount s, s)
--- | Return a 'Map' associating the given 'Sum_by_Unit' with their respective 'Unit'.
-by_Unit_from_List :: [Sum_by_Unit] -> By_Unit
+-- | Return a 'Map' associating the given 'Unit_Sum' with their respective 'Unit'.
+by_Unit_from_List :: [Unit_Sum] -> By_Unit
by_Unit_from_List balances =
Data.Map.fromListWith
- (\x y -> Sum_by_Unit
+ (\x y -> Unit_Sum
{ amount=(GHC.Num.+) (amount x) (amount y)
, accounts=Data.Map.union (accounts x) (accounts y)
}) $
- Data.List.map assoc_by_amount_unit balances
+ Data.List.map assoc_unit_sum balances
-- ** Incremental constructors
(by_account balance)
, by_unit =
Data.Map.unionWith
- (\x y -> Sum_by_Unit
+ (\x y -> Unit_Sum
{ amount = (GHC.Num.+) (amount x) (amount y)
, accounts = Data.Map.union (accounts x) (accounts y)
})
(by_unit balance) $
Data.Map.map
- (\amount -> Sum_by_Unit
+ (\amount -> Unit_Sum
{ amount
, accounts = Data.Map.singleton (Posting.account post) ()
})
(by_account b1)
, by_unit =
Data.Map.unionWith
- (\x y -> Sum_by_Unit
+ (\x y -> Unit_Sum
{ amount = (GHC.Num.+) (amount x) (amount y)
, accounts = Data.Map.union (accounts x) (accounts y)
})
(by_unit b1)
}
+-- * The 'Equilibre' type
+
+-- | See 'equilibre'.
+newtype Equilibre
+ = Equilibre By_Unit
+ deriving (Data, Eq, Read, Show, Typeable)
+
+-- | Return the 'by_unit' of the given 'Balance' with:
+--
+-- * 'Unit's whose 'Unit_Sum' 'amount' verifying 'Amount.is_zero' removed,
+--
+-- * and remaining 'Unit's having their 'Unit_Sum' 'accounts'
+-- complemented with the 'by_account' of the given 'Balance'
+-- (i.e. now mapping to accounts __not__ involved to build the 'Unit_Sum').
+equilibre :: Balance -> Equilibre
+equilibre balance = do
+ let max_accounts = Data.Map.size $ by_account balance
+ Equilibre $ Data.Map.foldlWithKey
+ (\m unit Unit_Sum{amount, accounts} ->
+ if Amount.is_zero $ amount
+ then m
+ else
+ case Data.Map.size accounts of
+ n | n == max_accounts ->
+ Data.Map.insert unit Unit_Sum{amount, accounts=Data.Map.empty} m
+ _ -> do
+ let d = Data.Map.map (const ()) $
+ Data.Map.difference (by_account balance) accounts
+ Data.Map.insert unit Unit_Sum{amount, accounts=d} m
+ )
+ Data.Map.empty
+ (by_unit balance)
+
-- ** Tests
--- | Return 'True' if and only if the 'Balance'
--- has all its 'by_unit' 'amount's verify 'Amount.is_zero'
--- or exactly one 'Account' of the 'by_unit' 'accounts' is not in 'by_account'.
-is_equilibrated :: Balance -> Bool
-is_equilibrated balance =
+-- | Return 'True' if and only if the given 'Equilibre' maps no 'Unit'.
+is_equilibrated :: Equilibre -> Bool
+is_equilibrated (Equilibre eq) = Data.Map.null eq
+
+-- | Return 'True' if and only if the given 'Equilibre' satisfies:
+--
+-- * 'is_equilibrated',
+-- * or 'is_inferrable'.
+is_equilibrable :: Equilibre -> Bool
+is_equilibrable e@(Equilibre eq) =
+ Data.Map.null eq || is_inferrable e
+
+-- | Return 'True' if and only if the given 'Equilibre'
+-- maps only to 'Unit_Sum's whose 'accounts'
+-- maps exactly one 'Account'.
+is_inferrable :: Equilibre -> Bool
+is_inferrable (Equilibre eq) =
Data.Foldable.all
- (\s ->
- (Amount.is_zero $ amount s) ||
- (Data.Map.size (accounts s) ==
- (Data.Map.size (by_account balance) - 1))) -- NOTE: Data.Map.size is O(1)
- (by_unit balance)
+ (\Unit_Sum{accounts} -> Data.Map.size accounts == 1)
+ eq
+
+-- | Return 'True' if and only if the given 'Equilibre'
+-- maps to at least one 'Unit_Sum's whose 'accounts'
+-- maps more than one 'Account'.
+is_non_inferrable :: Equilibre -> Bool
+is_non_inferrable (Equilibre eq) =
+ Data.Foldable.any
+ (\Unit_Sum{accounts} -> Data.Map.size accounts > 1)
+ eq
-- * The 'Expanded' type
+-- | See 'expand'.
newtype Expanded
= Expanded By_Account
deriving (Data, Eq, Read, Show, Typeable)
--- | Return the given 'By_Account'
--- with all missing 'Account.ascending' 'Account's inserted,
--- and every mapped Amount.'Amount.By_Unit'
--- added with any 'Account's Amount.'Amount.By_Unit'
--- to which it is 'Account.ascending'.
+-- | Return the given 'By_Account' with:
+--
+-- * all missing 'Account.ascending' 'Account's inserted,
+--
+-- * and every mapped Amount.'Amount.By_Unit'
+-- added with any Amount.'Amount.By_Unit'
+-- of the 'Account's’ for which it is 'Account.ascending'.
expand :: By_Account -> Expanded
expand balance =
-- TODO: because (+) is associative
[ (["A"], Amount.from_List [ Amount.usd $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
[ (["A"], Amount.from_List [ Amount.usd $ 0 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
[ (["A"], Amount.from_List [ Amount.usd $ 1, Amount.eur $ -1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ -1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.gbp $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
[ (["A"], Amount.from_List [ Amount.usd $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
[ (["A"], Amount.from_List [ Amount.usd $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
[ (["A"], Amount.from_List [ Amount.usd $ 2 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 2
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
[ (["A"], Amount.from_List [ Amount.usd $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
[ (["B"], Amount.from_List [ Amount.usd $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["B"]]
, (["B"], Amount.from_List [ Amount.usd $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 2
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
[ (["A"], Amount.from_List [ Amount.usd $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
[ (["B"], Amount.from_List [ Amount.eur $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["B"]]
, (["B"], Amount.from_List [ Amount.eur $ 1 ]) ]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["B"]]
, (["B"], Amount.from_List [ Amount.usd $ 1 ])
, (["B", "A"], Amount.from_List [ Amount.usd $ 1 ]) ])
]
- , "is_equilibrated" ~: TestList
- [ "nil = True" ~: TestCase $
+ , "is_equilibrable" ~: TestList
+ [ "nil" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.nil
- , "{A+$0, $+0} = True" ~: TestCase $
+ , "{A+$0, $+0}" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
]
}
- , "{A+$1, $+1} = False" ~: TestCase $
+ , "{A+$1, $+1}" ~: TestCase $
(@=?) False $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
]
}
- , "{A+$0+€0, $0 €+0} = True" ~: TestCase $
+ , "{A+$0+€0, $0 €+0}" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
]
}
- , "{A+$1, B-$1, $+0} = True" ~: TestCase $
+ , "{A+$1, B-$1, $+0}" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
}
]
}
- , "{A+$1 B, $+1} = True" ~: TestCase $
+ , "{A+$1 B, $+1}" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
]
}
- , "{A+$1 B+€1, $+1 €+1} = True" ~: TestCase $
+ , "{A+$1 B+€1, $+1 €+1}" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["B"]]
}
]
}
- , "{A+$1 B-$1+€1, $+0 €+1} = True" ~: TestCase $
+ , "{A+$1 B-$1+€1, $+0 €+1}" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 1
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["B"]]
}
]
}
- , "{A+$1+€2+£3 B-$1-€2-£3, $+0 €+0 £+0} = True" ~: TestCase $
+ , "{A+$1+€2+£3 B-$1-€2-£3, $+0 €+0 £+0}" ~: TestCase $
(@=?) True $
- Calc.Balance.is_equilibrated $
+ Calc.Balance.is_equilibrable $
+ Calc.Balance.equilibre $
Calc.Balance.Balance
{ Calc.Balance.by_account =
Data.Map.fromList
]
, Calc.Balance.by_unit =
Data.Map.fromList $
- Data.List.map Calc.Balance.assoc_by_amount_unit $
- [ Calc.Balance.Sum_by_Unit
+ Data.List.map Calc.Balance.assoc_unit_sum $
+ [ Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.usd $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.eur $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]
}
- , Calc.Balance.Sum_by_Unit
+ , Calc.Balance.Unit_Sum
{ Calc.Balance.amount = Amount.gbp $ 0
, Calc.Balance.accounts = Data.Map.fromList $ Data.List.map (,())
[["A"], ["B"]]