packages feed

hax 0.0.1 → 0.0.2

raw patch · 5 files changed

+73/−15 lines, 5 files

Files

README.md view
@@ -1,4 +1,27 @@ # hax-Haskell cash-flow and tax simulation+A library for cash-flow and tax simulations. The type system is used to ensure correctness e.g. of double-entry accounting, and the correct calculation of taxes. The use of Haskell's `do`-notation and type-classes permit an almost verbatim translation of the tax code into the program.++It currently includes personal income tax (Einkommensteuer), corporate tax (Körperschaftsteuer) and trade/business tax (Gewerbesteuer), but could easily be extended to other legal systems++## Usage++```+stack runghc -- -isrc src/main+```++will produce a folder named `html` containing the results of the [HAX.Example](src/HAX/Example.hs) that commes with this library. The look at the full ledger in `html/index.html` or the charts `static/charts.html`.++## Documentation++The docs on [Hackage](https://hackage.haskell.org/package/hax) are quite comprehensive (with some parts in German).+++## Srceenshots++![ledger](ledger.png)++Charts++![charts](charts.png)  
hax.cabal view
@@ -1,5 +1,5 @@ name: hax-version: 0.0.1+version: 0.0.2 cabal-version: >=1.10 build-type: Simple license: MIT@@ -22,6 +22,42 @@     static/charts-code.js     static/charts.html     static/code.js++library+    exposed-modules:+        HAX.Accounting+        HAX.Assets+        HAX.Bookkeeping+        HAX.Bookkeeping.Internal+        HAX.Common+        HAX.Germany+        HAX.Germany.NatuerlichePerson+        HAX.Germany.GmbH+        HAX.Germany.Einkommensteuer+        HAX.Germany.Gewerbe+        HAX.Germany.Subjekte+        HAX.Example+        HAX.Report+    build-depends:+        Decimal >=0.4.2 && <0.5,+        aeson >=0.11.2.1 && <0.12,+        array >=0.5.0.0 && <0.6,+        base >=4.9.0.0 && <4.10,+        blaze-html >=0.8.1.3 && <0.9,+        blaze-markup >=0.7.1.1 && <0.8,+        boxes >=0.1.4 && <0.2,+        bytestring >=0.10.8.1 && <0.11,+        containers >=0.5.5.1 && <0.6,+        directory >=1.2.6.2 && <1.3,+        filepath >=1.4.1.0 && <1.5,+        mtl >=2.2.1 && <2.3,+        split >=0.2.3.1 && <0.3,+        template-haskell >=2.11.0.0 && <2.12,+        text >=1.2.2.1 && <1.3,+        transformers >=0.5.2.0 && <0.6+    default-language: Haskell2010+    hs-source-dirs: src+    ghc-options: -O2  executable hax     main-is: main.hs
src/HAX/Bookkeeping/Internal.hs view
@@ -18,7 +18,7 @@ -- on accounts other than the current body's accounts (via -- 'UNSAFE_AccountN'). ----- Therefore, __do not use this module directly__, use "Bookkeeping" instead.+-- Therefore, __do not use this module directly__, use "HAX.Bookkeeping" instead. module HAX.Bookkeeping.Internal where  import           HAX.Common@@ -154,10 +154,10 @@ -- UNSAFE_Ledger and instead, the ledger is only changed using the -- exported safe functions. E.g. `tx`, 'fromTo', ... data LedgerRW = UNSAFE_Ledger-  -- | Balances for each Date and Account   { lUNSAFE_Bals :: IOArray LedgerIndex Amount-  -- | Transactions and Comments for each Date+  -- ^ Balances for each Date and Account   , lUNSAFE_LogEntries :: IOArray ADate [EntityLogEntry]+  -- ^ Transactions and Comments for each Date   }                  -- | This type implements the Ledger in immutable form, suitable as
src/HAX/Example.hs view
@@ -15,7 +15,7 @@ start = date 1 2014 example1 = World (start,date 12 2015) [facebookE, markZuck]             -facebookE = Entity "Facebook" ["AV"] facebookAction facebookGmbH+facebookE = Entity "FB" ["AV"] facebookAction facebookGmbH  facebookGmbH = GmbH facebook @@ -27,7 +27,7 @@                }  -markZuck = Entity "MarkZuck" ["Haus","Hausdarlehen","Cash" ] markZuckAction  markZuckNat+markZuck = Entity "Mark" ["Haus","Hausdarlehen","Cash" ] markZuckAction  markZuckNat  markZuckNat = NatuerlichePerson{ pGeburt = date 12 1960                          , kinderMitKindergeldImHaushalt = True@@ -62,7 +62,7 @@     tx $ BalancingTx "Anfangswerte"       privatVermoegen       [("Haus",240000)-      ,("Facebook",-430000)+      ,("FB",-430000)       ]    @@ -73,11 +73,11 @@      handle $ TransactionalAccount (IR verrechZins privatAusgaben)     (IR verrechZins sonstigeEinkuenfteAusKapitalvermoegen)-    "Facebook" 12+    "FB" 12    -- -- -- transferAll "clearing the shit" Cash Trash   -  -- fromTo 10 "mntl. Entnahme" "Facebook" "Cash" +  -- fromTo 10 "mntl. Entnahme" "FB" "Cash"     when (not $ pVersicherungsPflicht markZuckNat) $ do     tx $ BalancingTx "Kranken- & Pflegeversicherung"@@ -100,7 +100,7 @@   onceAt start $ do     tx $ BalancingTx "Anfangswerte"       "AV"-      [("MarkZuck",430000)+      [("Mark",430000)       ,(gewinnVerlustVortraege,-409000)       ] @@ -110,7 +110,7 @@      handle $ TransactionalAccount (IR verrechZins schuldZinsen)     (IR verrechZins sonstigerUeberschuss)-    "MarkZuck" 12+    "Mark" 12      tx $ BalancingTx "Ertrag"     sonstigerUeberschuss
src/HAX/Report.hs view
@@ -87,15 +87,14 @@ indexPage htmlBody = renderHtml $ docTypeHtml $ do      H.head $ do          meta ! charset "UTF-8"-         css "static/style.css"          js "http://code.jquery.com/jquery-1.11.1.min.js"          -- js "htpp://ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js"          -- js "http://d3js.org/d3.v3.min.js" ! charset "utf-8"          css "http://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css"          js "http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"          js "data.js"-         js "static/code.js"-         title "finmod results" +         js "../static/code.js"+         title "hax results"       body $ do H.table ! A.id "example" $ ""                htmlBody