From 85864b414e0cd81efcd031d18fa4243cc55103a7 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 27 Jan 2007 21:51:59 +0000 Subject: [PATCH] start --- hledger.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 hledger.hs diff --git a/hledger.hs b/hledger.hs new file mode 100644 index 000000000..b341904b2 --- /dev/null +++ b/hledger.hs @@ -0,0 +1,26 @@ +-- ledger-compatible money management tools +-- (c) 2007 Simon Michael & contributors, released under GPL v3 or later + +import Control.Exception (assert) + +-- data model +type Date = String +type Account = String +type Money = Float +-- a transaction records a movement of money between two accounts +data Transaction = Transaction { + date :: Date, + account :: Account, -- debit this + other_account :: Account, -- credit this + description :: String, + amount :: Money + } + +-- sample data +t1 = Transaction "2007-01-01" "checking" "food" "joe's diner" 8.50 + +-- tests +main = do + assert_ $ amount t1 == 8.50 + putStrLn "ok" + where assert_ e = assert e return ()