1 module Literate.Accounting.Move where
3 import Data.Function ((.))
4 import GHC.Stack (HasCallStack)
5 import Literate.Accounting.Chart
6 import Literate.Accounting.Math
7 import Literate.Accounting.Unit
10 data Account = Account
11 data Amount qty = Amount
13 , amountQuantity :: qty
15 instance Negable qty => Negable (Amount qty) where
16 negate Amount{..} = Amount{ amountQuantity = negate amountQuantity, ..}
19 type family AmountOf a
20 type family AccountOf a
21 type family AccountSectionOf a
23 type instance AmountOf [a] = AmountOf a
24 type instance AccountOf [a] = AccountOf a
25 type instance AccountSectionOf [a] = AccountSectionOf a
29 -- class Postable post where
30 -- post :: HasCallStack => AccountOf post -> AmountOf post -> post
32 class Postable acct unit qty post where
35 Postable acct unit qty post =>
43 Postable acct unit qty post =>
48 (-=) acct = (+=) acct . negate