From 533ba31d0a03600f57ad46f6e55229a7f2b60994 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Sat, 29 Mar 2025 21:24:40 +0100 Subject: Rename --- app/Main.hs | 64 +++++++++++++++++++++++++++++++++++++----------------- rdcapsis.cabal | 35 +++++++++++++++++++++++++++++ wayligmative.cabal | 35 ----------------------------- 3 files changed, 79 insertions(+), 55 deletions(-) create mode 100644 rdcapsis.cabal delete mode 100644 wayligmative.cabal 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 import System.IO (IOMode (ReadMode), withFile) import Text.Pretty.Simple (pPrint) --- data AccountType = Asset | Equity | Liability | Expense | Income --- --- data TxAction = Inc | Dec --- --- txAopp :: TxAction -> TxAction --- txaOpp Inc = Dec --- txaOpp Dec = Inc --- --- onDebit :: AccountType -> TxAction --- onDebit Asset = Inc --- onDebit Equity = Dec --- onDebit Liability = Dec --- onDebit Expense = Inc --- onDebit Income = Dec --- --- onCredit :: AccountType -> TxAction --- onCredit = txaOpp . onDebit --- --- data Tx = Tx { txDebit :: [(Account, Decimal)], txCredit :: [(Account, Decimal)] } deriving Show +data AccountType = Asset | Equity | Liability | Expense | Income + +data TxAction = Inc | Dec + +txAopp :: TxAction -> TxAction +txaOpp Inc = Dec +txaOpp Dec = Inc + +onDebit :: AccountType -> TxAction +onDebit Asset = Inc +onDebit Equity = Dec +onDebit Liability = Dec +onDebit Expense = Inc +onDebit Income = Dec + +onCredit :: AccountType -> TxAction +onCredit = txaOpp . onDebit + +data Ledger = [LedgerEntry] + +data LedgerEntry = TxEntry Tx | BalAssertEntry BalAssert + +-- A balance assertion is only valid when all transactions before it have been +-- cleared and the balance of the account agrees with the amount in the +-- assertion. +data BalAssert = BalAssert { + amount :: Decimal, + tags :: Tags } + +data Tx = Tx { + txClearedAt :: Maybe UTCTime, + txCommodity :: Commodity, + txDebit :: [(Account, Commodity, Rate, Amount)], + txCredit :: [(Account, Commodity, Rate, Amount)] + -- Description + -- Type: + } deriving Show + +data Account = Account { + acName :: [T.Text], + acCommodity :: Commodity, + acBalance :: Amount } + data Choice = Red | Blue | Green deriving (Show) @@ -91,7 +115,7 @@ theApp = main :: IO () main = do - let filename = "/home/rutgerbrf/Code/P/wayligmative/test3.csv" + let filename = "/home/rutgerbrf/Code/P/rdcapsis/test3.csv" putStrLn $ "Reading " ++ filename withFile filename ReadMode $ \h -> do entries <- Import.Ing.CurrentAccountCsv.readFile h diff --git a/rdcapsis.cabal b/rdcapsis.cabal new file mode 100644 index 0000000..5814782 --- /dev/null +++ b/rdcapsis.cabal @@ -0,0 +1,35 @@ +cabal-version: 3.0 +name: rdcapsis +version: 0.1.0.0 +maintainer: rutger@viasalix.nl +author: Rutger Broekhoff +build-type: Simple + +executable rdcapsis + main-is: Main.hs + hs-source-dirs: app + other-modules: + Data.Iban + Data.Res + Import.Ing.CurrentAccountCsv + Import.Ing.Shared + Import.Ing.SavingsAccountCsv + + default-language: GHC2024 + ghc-options: -Wall -threaded + build-depends: + base ^>=4.20.0.0, + parsec, + brick, + vty, + cassava, + Decimal, + text, + time, + attoparsec, + containers, + vector, + bytestring, + regex-tdfa, + tz, + pretty-simple diff --git a/wayligmative.cabal b/wayligmative.cabal deleted file mode 100644 index 99c811d..0000000 --- a/wayligmative.cabal +++ /dev/null @@ -1,35 +0,0 @@ -cabal-version: 3.0 -name: wayligmative -version: 0.1.0.0 -maintainer: rutger@viasalix.nl -author: Rutger Broekhoff -build-type: Simple - -executable wayligmative - main-is: Main.hs - hs-source-dirs: app - other-modules: - Data.Iban - Data.Res - Import.Ing.CurrentAccountCsv - Import.Ing.Shared - Import.Ing.SavingsAccountCsv - - default-language: GHC2024 - ghc-options: -Wall -threaded - build-depends: - base ^>=4.20.0.0, - parsec, - brick, - vty, - cassava, - Decimal, - text, - time, - attoparsec, - containers, - vector, - bytestring, - regex-tdfa, - tz, - pretty-simple -- cgit v1.2.3