mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
comments
This commit is contained in:
parent
d739ac0718
commit
88e50a3bfd
29
Types.hs
29
Types.hs
@ -4,11 +4,10 @@ import Utils
|
|||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
|
|
||||||
{-
|
{-
|
||||||
|
Here is the approximate module hierarchy. The early code defined types in
|
||||||
First, here is the module hierarchy. The initial implementation defined
|
each module and so was strictly layered. Now, all data types have been
|
||||||
types in each module and was strictly layered. Now, all types have been
|
moved to the bottom. The modules are still used to group related
|
||||||
moved to the bottom, with modules still used to group related functions
|
functions/methods ("make overview" to list those).
|
||||||
(aka methods - make overview to list those).
|
|
||||||
|
|
||||||
hledger
|
hledger
|
||||||
Options
|
Options
|
||||||
@ -28,7 +27,6 @@ hledger
|
|||||||
Currency
|
Currency
|
||||||
Types
|
Types
|
||||||
Utils
|
Utils
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
type Date = String
|
type Date = String
|
||||||
@ -37,7 +35,7 @@ type DateTime = String
|
|||||||
|
|
||||||
data Currency = Currency {
|
data Currency = Currency {
|
||||||
symbol :: String,
|
symbol :: String,
|
||||||
rate :: Double -- relative to the dollar
|
rate :: Double -- relative to the dollar.. 0 rates not supported yet
|
||||||
} deriving (Eq,Show)
|
} deriving (Eq,Show)
|
||||||
|
|
||||||
-- some amount of money, time, stock, oranges, etc.
|
-- some amount of money, time, stock, oranges, etc.
|
||||||
@ -47,19 +45,16 @@ data Amount = Amount {
|
|||||||
precision :: Int -- number of significant decimal places
|
precision :: Int -- number of significant decimal places
|
||||||
} deriving (Eq)
|
} deriving (Eq)
|
||||||
|
|
||||||
-- AccountNames are strings like "assets:cash:petty"; from these we build
|
-- AccountNames are strings like "assets:cash:petty"; from these we figure
|
||||||
-- the chart of accounts, which should be a simple hierarchy.
|
-- out the chart of accounts
|
||||||
type AccountName = String
|
type AccountName = String
|
||||||
|
|
||||||
-- a flow of an amount to an account
|
-- a flow of some amount to some account (see also EntryTransaction)
|
||||||
data Transaction = Transaction {
|
data Transaction = Transaction {
|
||||||
taccount :: AccountName,
|
taccount :: AccountName,
|
||||||
tamount :: Amount
|
tamount :: Amount
|
||||||
} deriving (Eq)
|
} deriving (Eq)
|
||||||
|
|
||||||
-- cleared ?
|
|
||||||
type EntryStatus = Bool
|
|
||||||
|
|
||||||
-- a ledger entry, with two or more balanced transactions
|
-- a ledger entry, with two or more balanced transactions
|
||||||
data Entry = Entry {
|
data Entry = Entry {
|
||||||
edate :: Date,
|
edate :: Date,
|
||||||
@ -69,19 +64,21 @@ data Entry = Entry {
|
|||||||
etransactions :: [Transaction]
|
etransactions :: [Transaction]
|
||||||
} deriving (Eq)
|
} deriving (Eq)
|
||||||
|
|
||||||
-- an "automated" entry (see = in ledger manual)
|
type EntryStatus = Bool
|
||||||
|
|
||||||
|
-- an "=" automated entry (ignored)
|
||||||
data ModifierEntry = ModifierEntry {
|
data ModifierEntry = ModifierEntry {
|
||||||
valueexpr :: String,
|
valueexpr :: String,
|
||||||
m_transactions :: [Transaction]
|
m_transactions :: [Transaction]
|
||||||
} deriving (Eq)
|
} deriving (Eq)
|
||||||
|
|
||||||
-- a periodic entry (see ~ in ledger manual)
|
-- a "~" periodic entry (ignored)
|
||||||
data PeriodicEntry = PeriodicEntry {
|
data PeriodicEntry = PeriodicEntry {
|
||||||
periodexpr :: String,
|
periodexpr :: String,
|
||||||
p_transactions :: [Transaction]
|
p_transactions :: [Transaction]
|
||||||
} deriving (Eq)
|
} deriving (Eq)
|
||||||
|
|
||||||
-- we also parse timeclock.el's timelogs (as a ledger)
|
-- we also parse timeclock.el timelogs
|
||||||
data TimeLogEntry = TimeLogEntry {
|
data TimeLogEntry = TimeLogEntry {
|
||||||
tcode :: Char,
|
tcode :: Char,
|
||||||
tdatetime :: DateTime,
|
tdatetime :: DateTime,
|
||||||
|
Loading…
Reference in New Issue
Block a user