| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hledger.Data
Description
The Hledger.Data library allows parsing and querying of C++ ledger-style journal files. It generally provides a compatible subset of C++ ledger's functionality. This package re-exports all the Hledger.Data.* modules (except UTF8, which requires an explicit import.)
Synopsis
- module Hledger.Data.Account
- module Hledger.Data.AccountName
- module Hledger.Data.Amount
- mapBalanceData :: (MixedAmount -> MixedAmount) -> BalanceData -> BalanceData
- opBalanceData :: (MixedAmount -> MixedAmount -> MixedAmount) -> BalanceData -> BalanceData -> BalanceData
- tests_BalanceData :: TestTree
- module Hledger.Data.Balancing
- module Hledger.Data.Currency
- module Hledger.Data.Dates
- data DayPartition
- boundariesToDayPartition :: NonEmpty Day -> DayPartition
- boundariesToMaybeDayPartition :: [Day] -> Maybe DayPartition
- dayPartitionToNonEmpty :: DayPartition -> NonEmpty (Day, Day)
- dayPartitionToList :: DayPartition -> [(Day, Day)]
- dayPartitionToDateSpans :: DayPartition -> [DateSpan]
- dayPartitionToPeriodData :: DayPartition -> PeriodData Day
- maybeDayPartitionToDateSpans :: Maybe DayPartition -> [DateSpan]
- unionDayPartitions :: DayPartition -> DayPartition -> Maybe DayPartition
- dayPartitionStartEnd :: DayPartition -> (Day, Day)
- dayPartitionFind :: Day -> DayPartition -> (Maybe Day, Day)
- splitSpan :: Bool -> Interval -> DateSpan -> Maybe DayPartition
- intervalBoundaryBefore :: Interval -> Day -> Day
- tests_DayPartition :: TestTree
- module Hledger.Data.Errors
- module Hledger.Data.Journal
- module Hledger.Data.JournalChecks
- module Hledger.Data.Json
- module Hledger.Data.Ledger
- module Hledger.Data.Period
- periodDataFromList :: a -> [(Day, a)] -> PeriodData a
- periodDataToList :: PeriodData a -> (a, [(Day, a)])
- lookupPeriodData :: Day -> PeriodData a -> Maybe (Day, a)
- lookupPeriodDataOrHistorical :: Day -> PeriodData a -> (Maybe Day, a)
- insertPeriodData :: Semigroup a => Maybe Day -> a -> PeriodData a -> PeriodData a
- opPeriodData :: (a -> b -> c) -> PeriodData a -> PeriodData b -> PeriodData c
- mergePeriodData :: (a -> c) -> (b -> c) -> (a -> b -> c) -> PeriodData a -> PeriodData b -> PeriodData c
- padPeriodData :: a -> PeriodData b -> PeriodData a -> PeriodData a
- tests_PeriodData :: TestTree
- module Hledger.Data.PeriodicTransaction
- module Hledger.Data.Posting
- module Hledger.Data.RawOptions
- module Hledger.Data.StringFormat
- module Hledger.Data.Timeclock
- module Hledger.Data.Transaction
- module Hledger.Data.TransactionModifier
- type Year = Integer
- type Tag = (TagName, TagValue)
- data Status
- type YearDay = Int
- type Month = Int
- type MonthDay = Int
- type Quarter = Int
- data Account a = Account {
- aname :: AccountName
- adeclarationinfo :: Maybe AccountDeclarationInfo
- asubs :: [Account a]
- aparent :: Maybe (Account a)
- aboring :: Bool
- adata :: PeriodData a
- type AccountName = Text
- data Amount = Amount {
- acommodity :: !CommoditySymbol
- aquantity :: !Quantity
- astyle :: !AmountStyle
- acost :: !(Maybe AmountCost)
- data BalanceData = BalanceData {}
- data Journal = Journal {
- jparsedefaultyear :: Maybe Year
- jparsedefaultcommodity :: Maybe (CommoditySymbol, AmountStyle)
- jparsedecimalmark :: Maybe DecimalMark
- jparseparentaccounts :: [AccountName]
- jparsealiases :: [AccountAlias]
- jparsetimeclockentries :: [TimeclockEntry]
- jincludefilestack :: [FilePath]
- jdeclaredpayees :: [(Payee, PayeeDeclarationInfo)]
- jdeclaredtags :: [(TagName, TagDeclarationInfo)]
- jdeclaredaccounts :: [(AccountName, AccountDeclarationInfo)]
- jdeclaredaccounttags :: Map AccountName [Tag]
- jdeclaredaccounttypes :: Map AccountType [AccountName]
- jaccounttypes :: Map AccountName AccountType
- jdeclaredcommodities :: Map CommoditySymbol Commodity
- jinferredcommoditystyles :: Map CommoditySymbol AmountStyle
- jglobalcommoditystyles :: Map CommoditySymbol AmountStyle
- jpricedirectives :: [PriceDirective]
- jinferredmarketprices :: [MarketPrice]
- jtxnmodifiers :: [TransactionModifier]
- jperiodictxns :: [PeriodicTransaction]
- jtxns :: [Transaction]
- jfinalcommentlines :: Text
- jfiles :: [(FilePath, Text)]
- jlastreadtime :: POSIXTime
- data Ledger = Ledger {
- ljournal :: Journal
- laccounts :: [Account BalanceData]
- data Period
- data PeriodData a = PeriodData {}
- data PeriodicTransaction = PeriodicTransaction {
- ptperiodexpr :: Text
- ptinterval :: Interval
- ptspan :: DateSpan
- ptsourcepos :: (SourcePos, SourcePos)
- ptstatus :: Status
- ptcode :: Text
- ptdescription :: Text
- ptcomment :: Text
- pttags :: [Tag]
- ptpostings :: [Posting]
- data Posting = Posting {
- pdate :: Maybe Day
- pdate2 :: Maybe Day
- pstatus :: Status
- paccount :: AccountName
- pamount :: MixedAmount
- pcomment :: Text
- ptype :: PostingType
- ptags :: [Tag]
- pbalanceassertion :: Maybe BalanceAssertion
- ptransaction :: Maybe Transaction
- poriginal :: Maybe Posting
- data Transaction = Transaction {}
- data TransactionModifier = TransactionModifier {}
- type CommoditySymbol = Text
- data AmountPrecision
- data MixedAmount
- type YearWeek = Int
- type MonthWeek = Int
- type WeekDay = Int
- data SmartDate
- data SmartInterval
- data WhichDate
- data EFDay
- data DateSpan = DateSpan (Maybe EFDay) (Maybe EFDay)
- data Interval
- type Payee = Text
- data DepthSpec = DepthSpec {
- dsFlatDepth :: Maybe Int
- dsRegexpDepths :: [(Regexp, Int)]
- data AccountType
- data AccountAlias
- data Side
- type DecimalMark = Char
- type Quantity = Decimal
- data AmountCost
- data AmountStyle = AmountStyle {
- ascommodityside :: !Side
- ascommodityspaced :: !Bool
- asdigitgroups :: !(Maybe DigitGroupStyle)
- asdecimalmark :: !(Maybe Char)
- asprecision :: !AmountPrecision
- asrounding :: !Rounding
- data DigitGroupStyle = DigitGroups !Char ![Word8]
- data Rounding
- data Commodity = Commodity {}
- class HasAmounts a where
- styleAmounts :: Map CommoditySymbol AmountStyle -> a -> a
- data PostingType
- type TagName = Text
- type TagValue = Text
- type HiddenTag = Tag
- type DateTag = (TagName, Day)
- data BalanceAssertion = BalanceAssertion {
- baamount :: Amount
- batotal :: Bool
- bainclusive :: Bool
- baposition :: SourcePos
- data TMPostingRule = TMPostingRule {}
- data TimeclockCode
- = SetBalance
- | SetRequiredHours
- | In
- | Out
- | FinalOut
- data TimeclockEntry = TimeclockEntry {
- tlsourcepos :: SourcePos
- tlcode :: TimeclockCode
- tldatetime :: LocalTime
- tlaccount :: AccountName
- tldescription :: Text
- tlcomment :: Text
- tltags :: [Tag]
- data PriceDirective = PriceDirective {}
- data MarketPrice = MarketPrice {
- mpdate :: Day
- mpfrom :: CommoditySymbol
- mpto :: CommoditySymbol
- mprate :: Quantity
- data PayeeDeclarationInfo = PayeeDeclarationInfo {
- pdicomment :: Text
- pditags :: [Tag]
- newtype TagDeclarationInfo = TagDeclarationInfo {
- tdicomment :: Text
- data AccountDeclarationInfo = AccountDeclarationInfo {
- adicomment :: Text
- aditags :: [Tag]
- adideclarationorder :: Int
- adisourcepos :: SourcePos
- type ParsedJournal = Journal
- data SepFormat
- data StorageFormat
- data NormalSign
- pattern MixedAmountKeyNoCost :: !CommoditySymbol -> MixedAmountKey
- pattern MixedAmountKeyTotalCost :: !CommoditySymbol -> !CommoditySymbol -> MixedAmountKey
- pattern MixedAmountKeyUnitCost :: !CommoditySymbol -> !CommoditySymbol -> !Quantity -> MixedAmountKey
- fromEFDay :: EFDay -> Day
- modifyEFDay :: (Day -> Day) -> EFDay -> EFDay
- isBalanceSheetAccountType :: AccountType -> Bool
- isIncomeStatementAccountType :: AccountType -> Bool
- isAccountSubtypeOf :: AccountType -> AccountType -> Bool
- isDecimalMark :: Char -> Bool
- maCompare :: MixedAmount -> MixedAmount -> Ordering
- toHiddenTag :: Tag -> HiddenTag
- toHiddenTagName :: TagName -> TagName
- toVisibleTag :: HiddenTag -> Tag
- toVisibleTagName :: TagName -> TagName
- isHiddenTagName :: TagName -> Bool
- nullsourcepos :: SourcePos
- nullsourcepospair :: (SourcePos, SourcePos)
- nulltransactionmodifier :: TransactionModifier
- nullperiodictransaction :: PeriodicTransaction
- showMarketPrice :: MarketPrice -> String
- showMarketPrices :: [MarketPrice] -> [Char]
- nullpayeedeclarationinfo :: PayeeDeclarationInfo
- nulltagdeclarationinfo :: TagDeclarationInfo
- nullaccountdeclarationinfo :: AccountDeclarationInfo
- module Hledger.Data.Valuation
- tests_Data :: TestTree
Documentation
module Hledger.Data.Account
module Hledger.Data.AccountName
module Hledger.Data.Amount
mapBalanceData :: (MixedAmount -> MixedAmount) -> BalanceData -> BalanceData Source #
Apply an operation to both MixedAmount in an BalanceData.
opBalanceData :: (MixedAmount -> MixedAmount -> MixedAmount) -> BalanceData -> BalanceData -> BalanceData Source #
Merge two BalanceData, using the given operation to combine their amounts.
module Hledger.Data.Balancing
module Hledger.Data.Currency
module Hledger.Data.Dates
data DayPartition Source #
A partition of time into one or more contiguous periods,
plus a historical period that precedes them.
Note DayPartition does not store per-period data - only the periods' start/end dates.
Instances
| Show DayPartition Source # | |
Defined in Hledger.Data.DayPartition | |
| Eq DayPartition Source # | |
Defined in Hledger.Data.DayPartition Methods (==) :: DayPartition -> DayPartition -> Bool Source # (/=) :: DayPartition -> DayPartition -> Bool Source # | |
| Ord DayPartition Source # | |
Defined in Hledger.Data.DayPartition Methods compare :: DayPartition -> DayPartition -> Ordering Source # (<) :: DayPartition -> DayPartition -> Bool Source # (<=) :: DayPartition -> DayPartition -> Bool Source # (>) :: DayPartition -> DayPartition -> Bool Source # (>=) :: DayPartition -> DayPartition -> Bool Source # max :: DayPartition -> DayPartition -> DayPartition Source # min :: DayPartition -> DayPartition -> DayPartition Source # | |
constructors
boundariesToDayPartition :: NonEmpty Day -> DayPartition Source #
Construct a DayPartition from a non-empty list of period boundary dates (start dates plus a final exclusive end date).
>>>boundariesToDayPartition (fromGregorian 2025 01 01 :| [fromGregorian 2025 02 01])DayPartition {dayPartitionToPeriodData = PeriodData{ pdpre = 2024-12-31, pdperiods = fromList [(2025-01-01,2025-01-31)]}}
boundariesToMaybeDayPartition :: [Day] -> Maybe DayPartition Source #
Construct a DayPartition from a list of period boundary dates (start dates plus a final exclusive end date),
if it's a non-empty list.
conversions
dayPartitionToNonEmpty :: DayPartition -> NonEmpty (Day, Day) Source #
Convert DayPartition to a non-empty list of period start and end dates (both inclusive).
Each end date will be one day before the next period's start date.
dayPartitionToList :: DayPartition -> [(Day, Day)] Source #
Convert DayPartition to a list (which will always be non-empty) of period start and end dates (both inclusive).
Each end date will be one day before the next period's start date.
dayPartitionToDateSpans :: DayPartition -> [DateSpan] Source #
Convert DayPartition to a list of DateSpans.
Each span will end one day before the next span begins
(the span's exclusive end date will be equal to the next span's start date).
operations
unionDayPartitions :: DayPartition -> DayPartition -> Maybe DayPartition Source #
Return the union of two DayPartitions if that is a valid DayPartition,
or Nothing otherwise.
dayPartitionStartEnd :: DayPartition -> (Day, Day) Source #
Get this DayPartition's overall start date and end date (both inclusive).
dayPartitionFind :: Day -> DayPartition -> (Maybe Day, Day) Source #
Find the start and end dates of the period within a DayPartition which contains a given day.
If the day is after the end of the last period, it is assumed to be within the last period.
If the day is before the start of the first period (ie, in the historical period),
only the historical period's end date is returned.
splitSpan :: Bool -> Interval -> DateSpan -> Maybe DayPartition Source #
Split a DateSpan into a DayPartition consisting of consecutive exact
spans of the specified Interval, or Nothing if the span is invalid.
If no interval is specified, the original span is returned.
If the original span is the null date span, ie unbounded, Nothing is returned.
If the original span is empty, eg if the end date is <= the start date, Nothing is returned.
Date adjustment
Some intervals respect the "adjust" flag (years, quarters, months, weeks, every Nth weekday of month seem to be the ones that need it). This will move the start date earlier, if needed, to the previous natural interval boundary (first of year, first of quarter, first of month, monday, previous Nth weekday of month). Related: #1982 #2218
The end date is always moved later if needed to the next natural interval boundary, so that the last period is the same length as the others.
Examples
>>>let t i y1 m1 d1 y2 m2 d2 = fmap dayPartitionToNonEmpty . splitSpan True i $ DateSpan (Just $ Flex $ fromGregorian y1 m1 d1) (Just $ Flex $ fromGregorian y2 m2 d2)>>>t NoInterval 2008 01 01 2009 01 01Just ((2008-01-01,2008-12-31) :| [])>>>t (Quarters 1) 2008 01 01 2009 01 01Just ((2008-01-01,2008-03-31) :| [(2008-04-01,2008-06-30),(2008-07-01,2008-09-30),(2008-10-01,2008-12-31)])>>>splitSpan True (Quarters 1) nulldatespanNothing>>>t (Days 1) 2008 01 01 2008 01 01 -- an empty datespanNothing>>>t (Quarters 1) 2008 01 01 2008 01 01Nothing>>>t (Months 1) 2008 01 01 2008 04 01Just ((2008-01-01,2008-01-31) :| [(2008-02-01,2008-02-29),(2008-03-01,2008-03-31)])>>>t (Months 2) 2008 01 01 2008 04 01Just ((2008-01-01,2008-02-29) :| [(2008-03-01,2008-04-30)])>>>t (Weeks 1) 2008 01 01 2008 01 15Just ((2007-12-31,2008-01-06) :| [(2008-01-07,2008-01-13),(2008-01-14,2008-01-20)])>>>t (Weeks 2) 2008 01 01 2008 01 15Just ((2007-12-31,2008-01-13) :| [(2008-01-14,2008-01-27)])>>>t (MonthDay 2) 2008 01 01 2008 04 01Just ((2008-01-02,2008-02-01) :| [(2008-02-02,2008-03-01),(2008-03-02,2008-04-01)])>>>t (NthWeekdayOfMonth 2 4) 2011 01 01 2011 02 15Just ((2010-12-09,2011-01-12) :| [(2011-01-13,2011-02-09),(2011-02-10,2011-03-09)])>>>t (DaysOfWeek [2]) 2011 01 01 2011 01 15Just ((2010-12-28,2011-01-03) :| [(2011-01-04,2011-01-10),(2011-01-11,2011-01-17)])>>>t (MonthAndDay 11 29) 2012 10 01 2013 10 15Just ((2012-11-29,2013-11-28) :| [])
intervalBoundaryBefore :: Interval -> Day -> Day Source #
Get the natural start for the given interval that falls on or before the given day, when applicable. Works for Weeks, Months, Quarters, Years, eg.
tests
module Hledger.Data.Errors
module Hledger.Data.Journal
module Hledger.Data.JournalChecks
module Hledger.Data.Json
module Hledger.Data.Ledger
module Hledger.Data.Period
periodDataFromList :: a -> [(Day, a)] -> PeriodData a Source #
Construct a PeriodData from a historical data value and a list of (period start, period data) pairs.
periodDataToList :: PeriodData a -> (a, [(Day, a)]) Source #
Convert PeriodData to a historical data value and a list of (period start, period data) pairs.
lookupPeriodData :: Day -> PeriodData a -> Maybe (Day, a) Source #
Get the data for the period containing the given SmartInterval, and that period's start date.
If the day is after the end of the last period, it is assumed to be within the last period.
If the day is before the start of the first period (ie, in the historical period), return Nothing.
lookupPeriodDataOrHistorical :: Day -> PeriodData a -> (Maybe Day, a) Source #
Get the data for the period containing the given SmartInterval, and that period's start date.
If the day is after the end of the last period, it is assumed to be within the last period.
If the day is before the start of the first period (ie, in the historical period),
return the data for the historical period and no start date.
insertPeriodData :: Semigroup a => Maybe Day -> a -> PeriodData a -> PeriodData a Source #
Set historical or period data in the appropriate location in a PeriodData.
opPeriodData :: (a -> b -> c) -> PeriodData a -> PeriodData b -> PeriodData c Source #
Merge two PeriodData, using the given operation to combine their data values.
This will drop keys if they are not present in both PeriodData.
mergePeriodData :: (a -> c) -> (b -> c) -> (a -> b -> c) -> PeriodData a -> PeriodData b -> PeriodData c Source #
Merge two PeriodData, using the given operations for combining data
that's only in the first, only in the second, or in both, respectively.
padPeriodData :: a -> PeriodData b -> PeriodData a -> PeriodData a Source #
Pad out the date map of a PeriodData so that every key from another PeriodData is present.
module Hledger.Data.Posting
module Hledger.Data.RawOptions
module Hledger.Data.StringFormat
module Hledger.Data.Timeclock
module Hledger.Data.Transaction
The status of a transaction or posting, recorded with a status mark (nothing, !, or *). What these mean is ultimately user defined.
Instances
| FromJSON Status Source # | |
| ToJSON Status Source # | |
| Bounded Status Source # | |
| Enum Status Source # | |
Defined in Hledger.Data.Types Methods succ :: Status -> Status Source # pred :: Status -> Status Source # toEnum :: Int -> Status Source # fromEnum :: Status -> Int Source # enumFrom :: Status -> [Status] Source # enumFromThen :: Status -> Status -> [Status] Source # enumFromTo :: Status -> Status -> [Status] Source # enumFromThenTo :: Status -> Status -> Status -> [Status] Source # | |
| Generic Status Source # | |
| Show Status Source # | |
| NFData Status Source # | |
Defined in Hledger.Data.Types | |
| Eq Status Source # | |
| Ord Status Source # | |
| type Rep Status Source # | |
Defined in Hledger.Data.Types type Rep Status = D1 ('MetaData "Status" "Hledger.Data.Types" "hledger-lib-1.50.3-ABaCjsMZ3mfJvGwbSVH5pJ" 'False) (C1 ('MetaCons "Unmarked" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Pending" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Cleared" 'PrefixI 'False) (U1 :: Type -> Type))) | |
An account within a hierarchy, with references to its parent
and subaccounts if any, and with per-report-period data of type a.
Only the name is required; the other fields may or may not be present.
Constructors
| Account | |
Fields
| |
Instances
type AccountName = Text Source #
Constructors
| Amount | |
Fields
| |
Instances
data BalanceData Source #
Data that's useful in "balance" reports: subaccount-exclusive and -inclusive amounts, typically representing either a balance change or an end balance; and a count of postings.
Constructors
| BalanceData | |
Fields
| |
Instances
A journal, containing general ledger transactions; also directives and various other things. This is hledger's main data model.
During parsing, it is used as the type alias ParsedJournal. The jparse* fields are mainly used during parsing and included here for convenience. The list fields described as "in parse order" are usually reversed for efficiency during parsing. After parsing, "journalFinalise" converts ParsedJournal to a finalised Journal, which has all lists correctly ordered, and much data inference and validation applied.
Constructors
| Journal | |
Fields
| |
Instances
A Ledger has the journal it derives from, and the accounts derived from that. Accounts are accessible both list-wise and tree-wise, since each one knows its parent and subs; the first account is the root of the tree and always exists.
Instances
| ToJSON Ledger Source # | |
| Generic Ledger Source # | |
| Show Ledger Source # | |
| type Rep Ledger Source # | |
Defined in Hledger.Data.Types type Rep Ledger = D1 ('MetaData "Ledger" "Hledger.Data.Types" "hledger-lib-1.50.3-ABaCjsMZ3mfJvGwbSVH5pJ" 'False) (C1 ('MetaCons "Ledger" 'PrefixI 'True) (S1 ('MetaSel ('Just "ljournal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Journal) :*: S1 ('MetaSel ('Just "laccounts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Account BalanceData]))) | |
Constructors
| DayPeriod Day | |
| WeekPeriod Day | |
| MonthPeriod Year Month | |
| QuarterPeriod Year Quarter | |
| YearPeriod Year | |
| PeriodBetween Day Day | |
| PeriodFrom Day | |
| PeriodTo Day | |
| PeriodAll |
Instances
data PeriodData a Source #
A general container for storing data values associated with zero or more contiguous report (sub)periods, and with the (open ended) pre-report period. The report periods are typically all the same length, but need not be.
Report periods are represented only by their start dates, used as the keys of a Map.
Constructors
| PeriodData | |
Instances
data PeriodicTransaction Source #
A periodic transaction rule, describing a transaction that recurs.
Constructors
| PeriodicTransaction | |
Fields
| |
Instances
Constructors
| Posting | |
Fields
| |
Instances
data Transaction Source #
Constructors
| Transaction | |
Fields
| |
Instances
data TransactionModifier Source #
A transaction modifier rule. This has a query which matches postings in the journal, and a list of transformations to apply to those postings or their transactions. Currently there is one kind of transformation: the TMPostingRule, which adds a posting ("auto posting") to the transaction, optionally setting its amount to the matched posting's amount multiplied by a constant.
Constructors
| TransactionModifier | |
Fields
| |
Instances
type CommoditySymbol = Text Source #
data AmountPrecision Source #
The "display precision" for a hledger amount, by which we mean the number of decimal digits to display to the right of the decimal mark.
Constructors
| Precision !Word8 | show this many decimal digits (0..255) |
| NaturalPrecision | show all significant decimal digits stored internally |
Instances
data MixedAmount Source #
Instances
A possibly incomplete year-month-day date provided by the user, to be
interpreted as either a date or a date span depending on context. Missing
parts "on the left" will be filled from the provided reference date, e.g. if
the year and month are missing, the reference date's year and month are used.
Missing parts "on the right" are assumed, when interpreting as a date, to be
1, (e.g. if the year and month are present but the day is missing, it means
first day of that month); or when interpreting as a date span, to be a
wildcard (so it would mean all days of that month). See the smartdate
parser for more examples.
Or, one of the standard periods and an offset relative to the reference date: (last|this|next) (day|week|month|quarter|year), where "this" means the period containing the reference date.
data SmartInterval Source #
Instances
| Show SmartInterval Source # | |
Defined in Hledger.Data.Types | |
Constructors
| PrimaryDate | |
| SecondaryDate |
A date which is either exact or flexible. Flexible dates are allowed to be adjusted in certain situations.
Instances
| ToJSON EFDay Source # | |
| Generic EFDay Source # | |
| Show EFDay Source # | |
| NFData EFDay Source # | |
Defined in Hledger.Data.Types | |
| Eq EFDay Source # | |
| Ord EFDay Source # | |
Defined in Hledger.Data.Types | |
| type Rep EFDay Source # | |
Defined in Hledger.Data.Types type Rep EFDay = D1 ('MetaData "EFDay" "Hledger.Data.Types" "hledger-lib-1.50.3-ABaCjsMZ3mfJvGwbSVH5pJ" 'False) (C1 ('MetaCons "Exact" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Day)) :+: C1 ('MetaCons "Flex" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Day))) | |
A possibly open-ended span of time, from an optional inclusive start date to an optional exclusive end date. Each date can be either exact or flexible. An "exact date span" is a Datepan with exact start and end dates.
Instances
| ToJSON DateSpan Source # | |
| Generic DateSpan Source # | |
| Show DateSpan Source # | |
| Default DateSpan Source # | |
Defined in Hledger.Data.Types | |
| NFData DateSpan Source # | |
Defined in Hledger.Data.Types | |
| Eq DateSpan Source # | |
| Ord DateSpan Source # | |
Defined in Hledger.Data.Types | |
| type Rep DateSpan Source # | |
Defined in Hledger.Data.Types type Rep DateSpan = D1 ('MetaData "DateSpan" "Hledger.Data.Types" "hledger-lib-1.50.3-ABaCjsMZ3mfJvGwbSVH5pJ" 'False) (C1 ('MetaCons "DateSpan" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe EFDay)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe EFDay)))) | |
Constructors
| NoInterval | |
| Days Int | |
| Weeks Int | |
| Months Int | |
| Quarters Int | |
| Years Int | |
| NthWeekdayOfMonth Int Int | |
| MonthDay Int | |
| MonthAndDay Int Int | |
| DaysOfWeek [Int] |
Instances
Constructors
| DepthSpec | |
Fields
| |
data AccountType Source #
Constructors
| Asset | |
| Liability | |
| Equity | |
| Revenue | |
| Expense | |
| Cash | a subtype of Asset - liquid assets to show in cashflow report |
| Conversion | a subtype of Equity - account with which to balance commodity conversions |
Instances
data AccountAlias Source #
Constructors
| BasicAlias AccountName AccountName | |
| RegexAlias Regexp Replacement |
Instances
type DecimalMark = Char Source #
One of the decimal marks we support: either period or comma.
data AmountCost Source #
An amount's per-unit or total cost/selling price in another
commodity, as recorded in the journal entry eg with or @.
Cost, formerly AKA "transaction price". The amount is always positive.
Instances
data AmountStyle Source #
Display styles for amounts - things which can be detected during parsing, such as commodity side and spacing, digit group marks, decimal mark, number of decimal digits etc. Every Amount has an AmountStyle. After amounts are parsed from the input, for each Commodity a standard style is inferred and then used when displaying amounts in that commodity. Related to AmountFormat but higher level.
See also: - hledger manual > Commodity styles - hledger manual > Amounts - hledger manual > Commodity display style
Constructors
| AmountStyle | |
Fields
| |
Instances
data DigitGroupStyle Source #
A style for displaying digit groups in the integer part of a floating point number. It consists of the character used to separate groups (comma or period, whichever is not used as decimal point), and the size of each group, starting with the one nearest the decimal point. The last group size is assumed to repeat. Eg, comma between thousands is DigitGroups ',' [3].
Constructors
| DigitGroups !Char ![Word8] |
Instances
"Rounding strategy" - how to apply an AmountStyle's display precision to a posting amount (and its cost, if any). Mainly used to customise print's output, with --round=none|soft|hard|all.
Constructors
| NoRounding | keep display precisions unchanged in amt and cost |
| SoftRounding | do soft rounding of amt and cost amounts (show more or fewer decimal zeros to approximate the target precision, but don't hide significant digits) |
| HardRounding | do hard rounding of amt (use the exact target precision, possibly hiding significant digits), and soft rounding of cost |
| AllRounding | do hard rounding of amt and cost |
Instances
| FromJSON Rounding Source # | |
| ToJSON Rounding Source # | |
| Generic Rounding Source # | |
| Read Rounding Source # | |
| Show Rounding Source # | |
| NFData Rounding Source # | |
Defined in Hledger.Data.Types | |
| Eq Rounding Source # | |
| Ord Rounding Source # | |
Defined in Hledger.Data.Types | |
| type Rep Rounding Source # | |
Defined in Hledger.Data.Types type Rep Rounding = D1 ('MetaData "Rounding" "Hledger.Data.Types" "hledger-lib-1.50.3-ABaCjsMZ3mfJvGwbSVH5pJ" 'False) ((C1 ('MetaCons "NoRounding" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SoftRounding" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HardRounding" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AllRounding" 'PrefixI 'False) (U1 :: Type -> Type))) | |
Constructors
| Commodity | |
Fields | |
Instances
| ToJSON Commodity Source # | |
| Generic Commodity Source # | |
| Show Commodity Source # | |
| NFData Commodity Source # | |
Defined in Hledger.Data.Types | |
| Eq Commodity Source # | |
| type Rep Commodity Source # | |
Defined in Hledger.Data.Types type Rep Commodity = D1 ('MetaData "Commodity" "Hledger.Data.Types" "hledger-lib-1.50.3-ABaCjsMZ3mfJvGwbSVH5pJ" 'False) (C1 ('MetaCons "Commodity" 'PrefixI 'True) (S1 ('MetaSel ('Just "csymbol") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CommoditySymbol) :*: S1 ('MetaSel ('Just "cformat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe AmountStyle)))) | |
class HasAmounts a where Source #
Types with this class have one or more amounts, which can have display styles applied to them.
Methods
styleAmounts :: Map CommoditySymbol AmountStyle -> a -> a Source #
Instances
data PostingType Source #
Constructors
| RegularPosting | |
| VirtualPosting | |
| BalancedVirtualPosting |
Instances
data BalanceAssertion Source #
A balance assertion is a declaration about an account's expected balance at a certain point (posting date and parse order). They provide additional error checking and readability to a journal file.
A balance assignments is an instruction to hledger to adjust an account's balance to a certain amount at a certain point.
The BalanceAssertion type is used for representing both of these.
hledger supports multiple kinds of balance assertions/assignments, which differ in whether they refer to a single commodity or all commodities, and the (subaccount-)inclusive or exclusive account balance.
Constructors
| BalanceAssertion | |
Fields
| |
Instances
data TMPostingRule Source #
A transaction modifier transformation, which adds an extra posting to the matched posting's transaction. Can be like a regular posting, or can have the tmprIsMultiplier flag set, indicating that it's a multiplier for the matched posting's amount.
Constructors
| TMPostingRule | |
Fields | |
Instances
data TimeclockCode Source #
Constructors
| SetBalance | |
| SetRequiredHours | |
| In | |
| Out | |
| FinalOut |
Instances
data TimeclockEntry Source #
Constructors
| TimeclockEntry | |
Fields
| |
Instances
data PriceDirective Source #
A market price declaration made by the journal format's P directive. It declares two things: a historical exchange rate between two commodities, and an amount display style for the second commodity.
Constructors
| PriceDirective | |
Fields
| |
Instances
data MarketPrice Source #
A historical market price (exchange rate) from one commodity to another. A more concise form of a PriceDirective, without the amount display info.
Constructors
| MarketPrice | |
Fields
| |
Instances
data PayeeDeclarationInfo Source #
Extra information found in a payee directive.
Constructors
| PayeeDeclarationInfo | |
Fields
| |
Instances
newtype TagDeclarationInfo Source #
Extra information found in a tag directive.
Constructors
| TagDeclarationInfo | |
Fields
| |
Instances
data AccountDeclarationInfo Source #
Extra information about an account that can be derived from its account directive (and the other account directives).
Constructors
| AccountDeclarationInfo | |
Fields
| |
Instances
type ParsedJournal = Journal Source #
A journal in the process of being parsed, not yet finalised. The data is partial, and list fields are in reverse order.
One of the standard *-separated value file types known by hledger,
Instances
| Show SepFormat Source # | |
| Eq SepFormat Source # | |
| Ord SepFormat Source # | |
Defined in Hledger.Data.Types | |
data StorageFormat Source #
The id of a data format understood by hledger, eg journal or csv.
The --output-format option selects one of these for output.
Instances
| Show StorageFormat Source # | |
Defined in Hledger.Data.Types | |
| Eq StorageFormat Source # | |
Defined in Hledger.Data.Types Methods (==) :: StorageFormat -> StorageFormat -> Bool Source # (/=) :: StorageFormat -> StorageFormat -> Bool Source # | |
| Ord StorageFormat Source # | |
Defined in Hledger.Data.Types Methods compare :: StorageFormat -> StorageFormat -> Ordering Source # (<) :: StorageFormat -> StorageFormat -> Bool Source # (<=) :: StorageFormat -> StorageFormat -> Bool Source # (>) :: StorageFormat -> StorageFormat -> Bool Source # (>=) :: StorageFormat -> StorageFormat -> Bool Source # max :: StorageFormat -> StorageFormat -> StorageFormat Source # min :: StorageFormat -> StorageFormat -> StorageFormat Source # | |
data NormalSign Source #
Whether an account's balance is normally a positive number (in accounting terms, a debit balance) or a negative number (credit balance). Assets and expenses are normally positive (debit), while liabilities, equity and income are normally negative (credit). https://en.wikipedia.org/wiki/Normal_balance
Constructors
| NormallyPositive | |
| NormallyNegative |
Instances
| Show NormalSign Source # | |
Defined in Hledger.Data.Types | |
| Eq NormalSign Source # | |
Defined in Hledger.Data.Types Methods (==) :: NormalSign -> NormalSign -> Bool Source # (/=) :: NormalSign -> NormalSign -> Bool Source # | |
pattern MixedAmountKeyNoCost :: !CommoditySymbol -> MixedAmountKey Source #
pattern MixedAmountKeyTotalCost :: !CommoditySymbol -> !CommoditySymbol -> MixedAmountKey Source #
pattern MixedAmountKeyUnitCost :: !CommoditySymbol -> !CommoditySymbol -> !Quantity -> MixedAmountKey Source #
isAccountSubtypeOf :: AccountType -> AccountType -> Bool Source #
Check whether the first argument is a subtype of the second: either equal or one of the defined subtypes.
isDecimalMark :: Char -> Bool Source #
maCompare :: MixedAmount -> MixedAmount -> Ordering Source #
Compare two MixedAmounts, substituting 0 for the quantity of any missing commodities in either.
toHiddenTag :: Tag -> HiddenTag Source #
Add the _ prefix to a normal visible tag's name, making it a hidden tag.
toHiddenTagName :: TagName -> TagName Source #
Add the _ prefix to a normal visible tag's name, making it a hidden tag.
toVisibleTag :: HiddenTag -> Tag Source #
Drop the _ prefix from a hidden tag's name, making it a normal visible tag.
toVisibleTagName :: TagName -> TagName Source #
Drop the _ prefix from a hidden tag's name, making it a normal visible tag.
isHiddenTagName :: TagName -> Bool Source #
Does this tag name begin with the hidden tag prefix (_) ?
showMarketPrice :: MarketPrice -> String Source #
showMarketPrices :: [MarketPrice] -> [Char] Source #
module Hledger.Data.Valuation