diff options
-rw-r--r-- | app/Main.hs | 64 | ||||
-rw-r--r-- | rdcapsis.cabal (renamed from wayligmative.cabal) | 4 |
2 files changed, 46 insertions, 22 deletions
diff --git a/app/Main.hs b/app/Main.hs index 7b4551a..bc8ad37 100644 --- a/app/Main.hs +++ b/app/Main.hs | |||
@@ -20,25 +20,49 @@ import Import.Ing.SavingsAccountCsv qualified | |||
20 | import System.IO (IOMode (ReadMode), withFile) | 20 | import System.IO (IOMode (ReadMode), withFile) |
21 | import Text.Pretty.Simple (pPrint) | 21 | import Text.Pretty.Simple (pPrint) |
22 | 22 | ||
23 | -- data AccountType = Asset | Equity | Liability | Expense | Income | 23 | data AccountType = Asset | Equity | Liability | Expense | Income |
24 | -- | 24 | |
25 | -- data TxAction = Inc | Dec | 25 | data TxAction = Inc | Dec |
26 | -- | 26 | |
27 | -- txAopp :: TxAction -> TxAction | 27 | txAopp :: TxAction -> TxAction |
28 | -- txaOpp Inc = Dec | 28 | txaOpp Inc = Dec |
29 | -- txaOpp Dec = Inc | 29 | txaOpp Dec = Inc |
30 | -- | 30 | |
31 | -- onDebit :: AccountType -> TxAction | 31 | onDebit :: AccountType -> TxAction |
32 | -- onDebit Asset = Inc | 32 | onDebit Asset = Inc |
33 | -- onDebit Equity = Dec | 33 | onDebit Equity = Dec |
34 | -- onDebit Liability = Dec | 34 | onDebit Liability = Dec |
35 | -- onDebit Expense = Inc | 35 | onDebit Expense = Inc |
36 | -- onDebit Income = Dec | 36 | onDebit Income = Dec |
37 | -- | 37 | |
38 | -- onCredit :: AccountType -> TxAction | 38 | onCredit :: AccountType -> TxAction |
39 | -- onCredit = txaOpp . onDebit | 39 | onCredit = txaOpp . onDebit |
40 | -- | 40 | |
41 | -- data Tx = Tx { txDebit :: [(Account, Decimal)], txCredit :: [(Account, Decimal)] } deriving Show | 41 | data Ledger = [LedgerEntry] |
42 | |||
43 | data LedgerEntry = TxEntry Tx | BalAssertEntry BalAssert | ||
44 | |||
45 | -- A balance assertion is only valid when all transactions before it have been | ||
46 | -- cleared and the balance of the account agrees with the amount in the | ||
47 | -- assertion. | ||
48 | data BalAssert = BalAssert { | ||
49 | amount :: Decimal, | ||
50 | tags :: Tags } | ||
51 | |||
52 | data Tx = Tx { | ||
53 | txClearedAt :: Maybe UTCTime, | ||
54 | txCommodity :: Commodity, | ||
55 | txDebit :: [(Account, Commodity, Rate, Amount)], | ||
56 | txCredit :: [(Account, Commodity, Rate, Amount)] | ||
57 | -- Description | ||
58 | -- Type: | ||
59 | } deriving Show | ||
60 | |||
61 | data Account = Account { | ||
62 | acName :: [T.Text], | ||
63 | acCommodity :: Commodity, | ||
64 | acBalance :: Amount } | ||
65 | |||
42 | data Choice = Red | Blue | Green | 66 | data Choice = Red | Blue | Green |
43 | deriving (Show) | 67 | deriving (Show) |
44 | 68 | ||
@@ -91,7 +115,7 @@ theApp = | |||
91 | 115 | ||
92 | main :: IO () | 116 | main :: IO () |
93 | main = do | 117 | main = do |
94 | let filename = "/home/rutgerbrf/Code/P/wayligmative/test3.csv" | 118 | let filename = "/home/rutgerbrf/Code/P/rdcapsis/test3.csv" |
95 | putStrLn $ "Reading " ++ filename | 119 | putStrLn $ "Reading " ++ filename |
96 | withFile filename ReadMode $ \h -> do | 120 | withFile filename ReadMode $ \h -> do |
97 | entries <- Import.Ing.CurrentAccountCsv.readFile h | 121 | entries <- Import.Ing.CurrentAccountCsv.readFile h |
diff --git a/wayligmative.cabal b/rdcapsis.cabal index 99c811d..5814782 100644 --- a/wayligmative.cabal +++ b/rdcapsis.cabal | |||
@@ -1,11 +1,11 @@ | |||
1 | cabal-version: 3.0 | 1 | cabal-version: 3.0 |
2 | name: wayligmative | 2 | name: rdcapsis |
3 | version: 0.1.0.0 | 3 | version: 0.1.0.0 |
4 | maintainer: [email protected] | 4 | maintainer: [email protected] |
5 | author: Rutger Broekhoff | 5 | author: Rutger Broekhoff |
6 | build-type: Simple | 6 | build-type: Simple |
7 | 7 | ||
8 | executable wayligmative | 8 | executable rdcapsis |
9 | main-is: Main.hs | 9 | main-is: Main.hs |
10 | hs-source-dirs: app | 10 | hs-source-dirs: app |
11 | other-modules: | 11 | other-modules: |