lib: types whitespace
This commit is contained in:
parent
f7e0f75c4f
commit
ff09d60746
@ -89,11 +89,11 @@ instance NFData Price
|
|||||||
|
|
||||||
-- | Display style for an amount.
|
-- | Display style for an amount.
|
||||||
data AmountStyle = AmountStyle {
|
data AmountStyle = AmountStyle {
|
||||||
ascommodityside :: Side, -- ^ does the symbol appear on the left or the right ?
|
ascommodityside :: Side, -- ^ does the symbol appear on the left or the right ?
|
||||||
ascommodityspaced :: Bool, -- ^ space between symbol and quantity ?
|
ascommodityspaced :: Bool, -- ^ space between symbol and quantity ?
|
||||||
asprecision :: Int, -- ^ number of digits displayed after the decimal point
|
asprecision :: Int, -- ^ number of digits displayed after the decimal point
|
||||||
asdecimalpoint :: Maybe Char, -- ^ character used as decimal point: period or comma. Nothing means "unspecified, use default"
|
asdecimalpoint :: Maybe Char, -- ^ character used as decimal point: period or comma. Nothing means "unspecified, use default"
|
||||||
asdigitgroups :: Maybe DigitGroupStyle -- ^ style for displaying digit groups, if any
|
asdigitgroups :: Maybe DigitGroupStyle -- ^ style for displaying digit groups, if any
|
||||||
} deriving (Eq,Ord,Read,Show,Typeable,Data,Generic)
|
} deriving (Eq,Ord,Read,Show,Typeable,Data,Generic)
|
||||||
|
|
||||||
instance NFData AmountStyle
|
instance NFData AmountStyle
|
||||||
@ -120,9 +120,9 @@ instance NFData Commodity
|
|||||||
|
|
||||||
data Amount = Amount {
|
data Amount = Amount {
|
||||||
acommodity :: CommoditySymbol,
|
acommodity :: CommoditySymbol,
|
||||||
aquantity :: Quantity,
|
aquantity :: Quantity,
|
||||||
aprice :: Price, -- ^ the (fixed) price for this amount, if any
|
aprice :: Price, -- ^ the (fixed) price for this amount, if any
|
||||||
astyle :: AmountStyle
|
astyle :: AmountStyle
|
||||||
} deriving (Eq,Ord,Typeable,Data,Generic)
|
} deriving (Eq,Ord,Typeable,Data,Generic)
|
||||||
|
|
||||||
instance NFData Amount
|
instance NFData Amount
|
||||||
@ -151,17 +151,17 @@ instance Show ClearedStatus where -- custom show
|
|||||||
show Cleared = "*"
|
show Cleared = "*"
|
||||||
|
|
||||||
data Posting = Posting {
|
data Posting = Posting {
|
||||||
pdate :: Maybe Day, -- ^ this posting's date, if different from the transaction's
|
pdate :: Maybe Day, -- ^ this posting's date, if different from the transaction's
|
||||||
pdate2 :: Maybe Day, -- ^ this posting's secondary date, if different from the transaction's
|
pdate2 :: Maybe Day, -- ^ this posting's secondary date, if different from the transaction's
|
||||||
pstatus :: ClearedStatus,
|
pstatus :: ClearedStatus,
|
||||||
paccount :: AccountName,
|
paccount :: AccountName,
|
||||||
pamount :: MixedAmount,
|
pamount :: MixedAmount,
|
||||||
pcomment :: String, -- ^ this posting's comment lines, as a single non-indented multi-line string
|
pcomment :: String, -- ^ this posting's comment lines, as a single non-indented multi-line string
|
||||||
ptype :: PostingType,
|
ptype :: PostingType,
|
||||||
ptags :: [Tag], -- ^ tag names and values, extracted from the comment
|
ptags :: [Tag], -- ^ tag names and values, extracted from the comment
|
||||||
pbalanceassertion :: Maybe MixedAmount, -- ^ optional: the expected balance in the account after this posting
|
pbalanceassertion :: Maybe MixedAmount, -- ^ optional: the expected balance in the account after this posting
|
||||||
ptransaction :: Maybe Transaction -- ^ this posting's parent transaction (co-recursive types).
|
ptransaction :: Maybe Transaction -- ^ this posting's parent transaction (co-recursive types).
|
||||||
-- Tying this knot gets tedious, Maybe makes it easier/optional.
|
-- Tying this knot gets tedious, Maybe makes it easier/optional.
|
||||||
} deriving (Typeable,Data,Generic)
|
} deriving (Typeable,Data,Generic)
|
||||||
|
|
||||||
instance NFData Posting
|
instance NFData Posting
|
||||||
@ -179,31 +179,31 @@ data GenericSourcePos = GenericSourcePos FilePath Int Int
|
|||||||
instance NFData GenericSourcePos
|
instance NFData GenericSourcePos
|
||||||
|
|
||||||
data Transaction = Transaction {
|
data Transaction = Transaction {
|
||||||
tindex :: Integer, -- ^ this transaction's 1-based position in the input stream, or 0 when not available
|
tindex :: Integer, -- ^ this transaction's 1-based position in the input stream, or 0 when not available
|
||||||
tsourcepos :: GenericSourcePos,
|
tsourcepos :: GenericSourcePos,
|
||||||
tdate :: Day,
|
tdate :: Day,
|
||||||
tdate2 :: Maybe Day,
|
tdate2 :: Maybe Day,
|
||||||
tstatus :: ClearedStatus,
|
tstatus :: ClearedStatus,
|
||||||
tcode :: String,
|
tcode :: String,
|
||||||
tdescription :: String,
|
tdescription :: String,
|
||||||
tcomment :: String, -- ^ this transaction's comment lines, as a single non-indented multi-line string
|
tcomment :: String, -- ^ this transaction's comment lines, as a single non-indented multi-line string
|
||||||
ttags :: [Tag], -- ^ tag names and values, extracted from the comment
|
ttags :: [Tag], -- ^ tag names and values, extracted from the comment
|
||||||
tpostings :: [Posting], -- ^ this transaction's postings
|
tpostings :: [Posting], -- ^ this transaction's postings
|
||||||
tpreceding_comment_lines :: String -- ^ any comment lines immediately preceding this transaction
|
tpreceding_comment_lines :: String -- ^ any comment lines immediately preceding this transaction
|
||||||
} deriving (Eq,Typeable,Data,Generic)
|
} deriving (Eq,Typeable,Data,Generic)
|
||||||
|
|
||||||
instance NFData Transaction
|
instance NFData Transaction
|
||||||
|
|
||||||
data ModifierTransaction = ModifierTransaction {
|
data ModifierTransaction = ModifierTransaction {
|
||||||
mtvalueexpr :: String,
|
mtvalueexpr :: String,
|
||||||
mtpostings :: [Posting]
|
mtpostings :: [Posting]
|
||||||
} deriving (Eq,Typeable,Data,Generic)
|
} deriving (Eq,Typeable,Data,Generic)
|
||||||
|
|
||||||
instance NFData ModifierTransaction
|
instance NFData ModifierTransaction
|
||||||
|
|
||||||
data PeriodicTransaction = PeriodicTransaction {
|
data PeriodicTransaction = PeriodicTransaction {
|
||||||
ptperiodicexpr :: String,
|
ptperiodicexpr :: String,
|
||||||
ptpostings :: [Posting]
|
ptpostings :: [Posting]
|
||||||
} deriving (Eq,Typeable,Data,Generic)
|
} deriving (Eq,Typeable,Data,Generic)
|
||||||
|
|
||||||
instance NFData PeriodicTransaction
|
instance NFData PeriodicTransaction
|
||||||
@ -213,19 +213,19 @@ data TimeclockCode = SetBalance | SetRequiredHours | In | Out | FinalOut derivin
|
|||||||
instance NFData TimeclockCode
|
instance NFData TimeclockCode
|
||||||
|
|
||||||
data TimeclockEntry = TimeclockEntry {
|
data TimeclockEntry = TimeclockEntry {
|
||||||
tlsourcepos :: GenericSourcePos,
|
tlsourcepos :: GenericSourcePos,
|
||||||
tlcode :: TimeclockCode,
|
tlcode :: TimeclockCode,
|
||||||
tldatetime :: LocalTime,
|
tldatetime :: LocalTime,
|
||||||
tlaccount :: String,
|
tlaccount :: String,
|
||||||
tldescription :: String
|
tldescription :: String
|
||||||
} deriving (Eq,Ord,Typeable,Data,Generic)
|
} deriving (Eq,Ord,Typeable,Data,Generic)
|
||||||
|
|
||||||
instance NFData TimeclockEntry
|
instance NFData TimeclockEntry
|
||||||
|
|
||||||
data MarketPrice = MarketPrice {
|
data MarketPrice = MarketPrice {
|
||||||
mpdate :: Day,
|
mpdate :: Day,
|
||||||
mpcommodity :: CommoditySymbol,
|
mpcommodity :: CommoditySymbol,
|
||||||
mpamount :: Amount
|
mpamount :: Amount
|
||||||
} deriving (Eq,Ord,Typeable,Data,Generic) -- & Show (in Amount.hs)
|
} deriving (Eq,Ord,Typeable,Data,Generic) -- & Show (in Amount.hs)
|
||||||
|
|
||||||
instance NFData MarketPrice
|
instance NFData MarketPrice
|
||||||
@ -237,15 +237,15 @@ type Year = Integer
|
|||||||
-- Y directive is encountered. At the end of parsing, the final context
|
-- Y directive is encountered. At the end of parsing, the final context
|
||||||
-- is saved for later use by eg the add command.
|
-- is saved for later use by eg the add command.
|
||||||
data JournalContext = Ctx {
|
data JournalContext = Ctx {
|
||||||
ctxYear :: !(Maybe Year) -- ^ the default year most recently specified with Y
|
ctxYear :: !(Maybe Year) -- ^ the default year most recently specified with Y
|
||||||
, ctxDefaultCommodityAndStyle :: !(Maybe (CommoditySymbol,AmountStyle)) -- ^ the default commodity and amount style most recently specified with D
|
, ctxDefaultCommodityAndStyle :: !(Maybe (CommoditySymbol,AmountStyle)) -- ^ the default commodity and amount style most recently specified with D
|
||||||
, ctxAccounts :: ![AccountName] -- ^ the accounts that have been defined with account directives so far
|
, ctxAccounts :: ![AccountName] -- ^ the accounts that have been defined with account directives so far
|
||||||
, ctxParentAccount :: ![AccountName] -- ^ the current stack of parent accounts/account name components
|
, ctxParentAccount :: ![AccountName] -- ^ the current stack of parent accounts/account name components
|
||||||
-- specified with "apply account" directive(s). Concatenated, these
|
-- specified with "apply account" directive(s). Concatenated, these
|
||||||
-- are the account prefix prepended to parsed account names.
|
-- are the account prefix prepended to parsed account names.
|
||||||
, ctxAliases :: ![AccountAlias] -- ^ the current list of account name aliases in effect
|
, ctxAliases :: ![AccountAlias] -- ^ the current list of account name aliases in effect
|
||||||
, ctxTransactionIndex :: !Integer -- ^ the number of transactions read so far. (Does not count
|
, ctxTransactionIndex :: !Integer -- ^ the number of transactions read so far. (Does not count
|
||||||
-- timeclock/timedot/CSV entries, currently).
|
-- timeclock/timedot/CSV entries, currently).
|
||||||
} deriving (Read, Show, Eq, Data, Typeable, Generic)
|
} deriving (Read, Show, Eq, Data, Typeable, Generic)
|
||||||
|
|
||||||
instance NFData JournalContext
|
instance NFData JournalContext
|
||||||
@ -257,20 +257,20 @@ deriving instance Generic (ClockTime)
|
|||||||
instance NFData ClockTime
|
instance NFData ClockTime
|
||||||
|
|
||||||
data Journal = Journal {
|
data Journal = Journal {
|
||||||
jmodifiertxns :: [ModifierTransaction],
|
jmodifiertxns :: [ModifierTransaction],
|
||||||
jperiodictxns :: [PeriodicTransaction],
|
jperiodictxns :: [PeriodicTransaction],
|
||||||
jtxns :: [Transaction],
|
jtxns :: [Transaction],
|
||||||
jcommoditystyles :: M.Map CommoditySymbol AmountStyle, -- ^ commodities and formats inferred from journal amounts
|
jcommoditystyles :: M.Map CommoditySymbol AmountStyle, -- ^ commodities and formats inferred from journal amounts
|
||||||
jcommodities :: M.Map CommoditySymbol Commodity, -- ^ commodities and formats defined by commodity directives
|
jcommodities :: M.Map CommoditySymbol Commodity, -- ^ commodities and formats defined by commodity directives
|
||||||
open_timeclock_entries :: [TimeclockEntry],
|
open_timeclock_entries :: [TimeclockEntry],
|
||||||
jmarketprices :: [MarketPrice],
|
jmarketprices :: [MarketPrice],
|
||||||
final_comment_lines :: String, -- ^ any trailing comments from the journal file
|
final_comment_lines :: String, -- ^ any trailing comments from the journal file
|
||||||
jContext :: JournalContext, -- ^ the context (parse state) at the end of parsing
|
jContext :: JournalContext, -- ^ the context (parse state) at the end of parsing
|
||||||
files :: [(FilePath, String)], -- ^ the file path and raw text of the main and
|
files :: [(FilePath, String)], -- ^ the file path and raw text of the main and
|
||||||
-- any included journal files. The main file is
|
-- any included journal files. The main file is
|
||||||
-- first followed by any included files in the
|
-- first followed by any included files in the
|
||||||
-- order encountered.
|
-- order encountered.
|
||||||
filereadtime :: ClockTime -- ^ when this journal was last read from its file(s)
|
filereadtime :: ClockTime -- ^ when this journal was last read from its file(s)
|
||||||
} deriving (Eq, Typeable, Data, Generic)
|
} deriving (Eq, Typeable, Data, Generic)
|
||||||
|
|
||||||
instance NFData Journal
|
instance NFData Journal
|
||||||
@ -299,14 +299,14 @@ instance Show Reader where show r = rFormat r ++ " reader"
|
|||||||
-- | An account, with name, balances and links to parent/subaccounts
|
-- | An account, with name, balances and links to parent/subaccounts
|
||||||
-- which let you walk up or down the account tree.
|
-- which let you walk up or down the account tree.
|
||||||
data Account = Account {
|
data Account = Account {
|
||||||
aname :: AccountName, -- ^ this account's full name
|
aname :: AccountName, -- ^ this account's full name
|
||||||
aebalance :: MixedAmount, -- ^ this account's balance, excluding subaccounts
|
aebalance :: MixedAmount, -- ^ this account's balance, excluding subaccounts
|
||||||
asubs :: [Account], -- ^ sub-accounts
|
asubs :: [Account], -- ^ sub-accounts
|
||||||
anumpostings :: Int, -- ^ number of postings to this account
|
anumpostings :: Int, -- ^ number of postings to this account
|
||||||
-- derived from the above:
|
-- derived from the above :
|
||||||
aibalance :: MixedAmount, -- ^ this account's balance, including subaccounts
|
aibalance :: MixedAmount, -- ^ this account's balance, including subaccounts
|
||||||
aparent :: Maybe Account, -- ^ parent account
|
aparent :: Maybe Account, -- ^ parent account
|
||||||
aboring :: Bool -- ^ used in the accounts report to label elidable parents
|
aboring :: Bool -- ^ used in the accounts report to label elidable parents
|
||||||
} deriving (Typeable, Data, Generic)
|
} deriving (Typeable, Data, Generic)
|
||||||
|
|
||||||
-- | A Ledger has the journal it derives from, and the accounts
|
-- | A Ledger has the journal it derives from, and the accounts
|
||||||
@ -314,7 +314,7 @@ data Account = Account {
|
|||||||
-- tree-wise, since each one knows its parent and subs; the first
|
-- tree-wise, since each one knows its parent and subs; the first
|
||||||
-- account is the root of the tree and always exists.
|
-- account is the root of the tree and always exists.
|
||||||
data Ledger = Ledger {
|
data Ledger = Ledger {
|
||||||
ljournal :: Journal,
|
ljournal :: Journal,
|
||||||
laccounts :: [Account]
|
laccounts :: [Account]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user