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