ENH update types
This commit is contained in:
parent
0650ce1948
commit
ca7fef7a56
|
@ -251,16 +251,16 @@ let CronPat =
|
|||
This is similar to 'cron' patterns in unix-like systems.
|
||||
-}
|
||||
{ Type =
|
||||
{ cronWeekly : Optional WeekdayPat
|
||||
, cronYear : Optional MDYPat
|
||||
, cronMonth : Optional MDYPat
|
||||
, cronDay : Optional MDYPat
|
||||
{ cpWeekly : Optional WeekdayPat
|
||||
, cpYear : Optional MDYPat
|
||||
, cpMonth : Optional MDYPat
|
||||
, cpDay : Optional MDYPat
|
||||
}
|
||||
, default =
|
||||
{ cronWeekly = None WeekdayPat
|
||||
, cronYear = None MDYPat
|
||||
, cronMonth = None MDYPat
|
||||
, cronDay = None MDYPat
|
||||
{ cpWeekly = None WeekdayPat
|
||||
, cpYear = None MDYPat
|
||||
, cpMonth = None MDYPat
|
||||
, cpDay = None MDYPat
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ let ValMatcher =
|
|||
Means to match a decimal value.
|
||||
-}
|
||||
{ Type =
|
||||
{ mvSign :
|
||||
{ vmSign :
|
||||
{-
|
||||
Sign of value.
|
||||
True -> positive,
|
||||
|
@ -347,17 +347,17 @@ let ValMatcher =
|
|||
None -> do not consider.
|
||||
-}
|
||||
Optional Bool
|
||||
, mvNum :
|
||||
, vmNum :
|
||||
{-
|
||||
Value of numerator to match. Do not consider numerator if none
|
||||
-}
|
||||
Optional Natural
|
||||
, mvDen :
|
||||
, vmDen :
|
||||
{-
|
||||
Value of denominator to match. Do not consider numerator if none
|
||||
-}
|
||||
Optional Natural
|
||||
, mvPrec :
|
||||
, vmPrec :
|
||||
{-
|
||||
Precision of decimal to use when matching. This only affects the
|
||||
denominator, such that a query of '10.1' with a precision of 2
|
||||
|
@ -366,10 +366,10 @@ let ValMatcher =
|
|||
Natural
|
||||
}
|
||||
, default =
|
||||
{ mvSign = None Bool
|
||||
, mvNum = None Natural
|
||||
, mvDen = None Natural
|
||||
, mvPrec = 2
|
||||
{ vmSign = None Bool
|
||||
, vmNum = None Natural
|
||||
, vmDen = None Natural
|
||||
, vmPrec = 2
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,27 +443,27 @@ let Entry =
|
|||
\(v : Type) ->
|
||||
\(c : Type) ->
|
||||
\(t : Type) ->
|
||||
{ sAcnt :
|
||||
{ eAcnt :
|
||||
{-
|
||||
Pertains to account for this entry.
|
||||
-}
|
||||
a
|
||||
, sValue :
|
||||
, eValue :
|
||||
{-
|
||||
Pertains to value for this entry.
|
||||
-}
|
||||
v
|
||||
, sCurrency :
|
||||
, eCurrency :
|
||||
{-
|
||||
Pertains to value for this entry.
|
||||
-}
|
||||
c
|
||||
, sComment :
|
||||
, eComment :
|
||||
{-
|
||||
A short description of this entry (if none, use a blank string)
|
||||
-}
|
||||
Text
|
||||
, sTags :
|
||||
, eTags :
|
||||
{-
|
||||
Pertains to the tags to describe this entry.
|
||||
-}
|
||||
|
@ -476,7 +476,7 @@ let EntryGetter =
|
|||
-}
|
||||
{ Type =
|
||||
Entry EntryAcntGetter (Optional EntryNumGetter) EntryCurGetter TagID
|
||||
, default = { sValue = None EntryNumGetter, sComment = "" }
|
||||
, default = { eValue = None EntryNumGetter, eComment = "" }
|
||||
}
|
||||
|
||||
let TxGetter =
|
||||
|
@ -513,53 +513,53 @@ let StatementParser_ =
|
|||
-}
|
||||
\(re : Type) ->
|
||||
{ Type =
|
||||
{ mDate :
|
||||
{ spDate :
|
||||
{-
|
||||
How to match the date column; if none match any date
|
||||
-}
|
||||
Optional DateMatcher
|
||||
, mVal :
|
||||
, spVal :
|
||||
{-
|
||||
How to match the value column; if none match any value
|
||||
-}
|
||||
ValMatcher.Type
|
||||
, mDesc :
|
||||
, spDesc :
|
||||
{-
|
||||
Regular expression to match the description;
|
||||
if none match anythingS
|
||||
-}
|
||||
Optional re
|
||||
, mOther :
|
||||
, spOther :
|
||||
{-
|
||||
How to match additional columns if present
|
||||
-}
|
||||
List (FieldMatcher_ re)
|
||||
, mTx :
|
||||
, spTx :
|
||||
{-
|
||||
How to translate the matched statement row into entries for
|
||||
a transaction. If none, don't make a transaction (eg 'skip'
|
||||
this row in the statement).
|
||||
-}
|
||||
Optional TxGetter
|
||||
, mTimes :
|
||||
, spTimes :
|
||||
{-
|
||||
Match at most this many rows; if none there is no limit
|
||||
-}
|
||||
Optional Natural
|
||||
, mPriority :
|
||||
, spPriority :
|
||||
{-
|
||||
In case of multiple matches, higher priority gets precedence.
|
||||
-}
|
||||
Integer
|
||||
}
|
||||
, default =
|
||||
{ mDate = None DateMatcher
|
||||
, mVal = ValMatcher::{=}
|
||||
, mDesc = None Text
|
||||
, mOther = [] : List (FieldMatcher_ re)
|
||||
, mTx = None TxGetter
|
||||
, mTimes = None Natural
|
||||
, mPriority = +0
|
||||
{ spDate = None DateMatcher
|
||||
, spVal = ValMatcher::{=}
|
||||
, spDesc = None Text
|
||||
, spOther = [] : List (FieldMatcher_ re)
|
||||
, spTx = None TxGetter
|
||||
, spTimes = None Natural
|
||||
, spPriority = +0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -720,12 +720,12 @@ let TaxProgression =
|
|||
A tax progression using a deductible and a series of tax brackets.
|
||||
This will cover simple cases of the US income tax as of 2017 and similar.
|
||||
-}
|
||||
{ tbsDeductible :
|
||||
{ tpDeductible :
|
||||
{-
|
||||
Initial amount to subtract from after-pretax-deductions
|
||||
-}
|
||||
Decimal
|
||||
, tbsBrackets :
|
||||
, tpBrackets :
|
||||
{-
|
||||
Tax brackets to apply after deductions (order does not matter, each
|
||||
entry will be sorted by limit)
|
||||
|
@ -852,34 +852,34 @@ let TransferMatcher =
|
|||
fashion)
|
||||
-}
|
||||
{ Type =
|
||||
{ smFrom :
|
||||
{ tmFrom :
|
||||
{-
|
||||
List of accounts (which may be empty) to match with the
|
||||
starting account in a transfer.
|
||||
-}
|
||||
AcntSet.Type
|
||||
, smTo :
|
||||
, tmTo :
|
||||
{-
|
||||
List of accounts (which may be empty) to match with the
|
||||
ending account in a transfer.
|
||||
-}
|
||||
AcntSet.Type
|
||||
, smDate :
|
||||
, tmDate :
|
||||
{-
|
||||
If given, means to match the date of a transfer.
|
||||
-}
|
||||
Optional DateMatcher
|
||||
, smVal :
|
||||
, tmVal :
|
||||
{-
|
||||
If given, means to match the value of a transfer.
|
||||
-}
|
||||
ValMatcher.Type
|
||||
}
|
||||
, default =
|
||||
{ smFrom = AcntSet.default
|
||||
, smTo = AcntSet.default
|
||||
, smDate = None DateMatcher
|
||||
, smVal = ValMatcher.default
|
||||
{ tmFrom = AcntSet.default
|
||||
, tmTo = AcntSet.default
|
||||
, tmDate = None DateMatcher
|
||||
, tmVal = ValMatcher.default
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -951,19 +951,19 @@ let Budget =
|
|||
A hypothetical set of transactions (eg a "budget") to be generated
|
||||
and inserted into the database.
|
||||
-}
|
||||
{ budgetLabel :
|
||||
{ bgtLabel :
|
||||
{-
|
||||
A unique label for this budget.
|
||||
|
||||
Can be useful to compare multiple potential futures.
|
||||
-}
|
||||
Text
|
||||
, incomes : List Income.Type
|
||||
, pretax : List (MultiAllocation PretaxValue)
|
||||
, tax : List (MultiAllocation TaxValue)
|
||||
, posttax : List (MultiAllocation PosttaxValue)
|
||||
, transfers : List BudgetTransfer
|
||||
, shadowTransfers : List ShadowTransfer
|
||||
, bgtIncomes : List Income.Type
|
||||
, bgtPretax : List (MultiAllocation PretaxValue)
|
||||
, bgtTax : List (MultiAllocation TaxValue)
|
||||
, bgtPosttax : List (MultiAllocation PosttaxValue)
|
||||
, bgtTransfers : List BudgetTransfer
|
||||
, bgtShadowTransfers : List ShadowTransfer
|
||||
}
|
||||
|
||||
in { CurID
|
||||
|
|
|
@ -20,7 +20,7 @@ let d_ = dec2 False
|
|||
let nullSplit =
|
||||
\(a : T.EntryAcntGetter) ->
|
||||
\(c : T.EntryCurGetter) ->
|
||||
T.EntryGetter::{ sAcnt = a, sCurrency = c, sTags = [] : List T.TagID }
|
||||
T.EntryGetter::{ eAcnt = a, eCurrency = c, eTags = [] : List T.TagID }
|
||||
|
||||
let nullOpts = T.TxOpts::{=}
|
||||
|
||||
|
@ -41,9 +41,9 @@ let cron1 =
|
|||
\(d : Natural) ->
|
||||
T.DatePat.Cron
|
||||
( nullCron
|
||||
// { cronYear = Some (T.MDYPat.Single y)
|
||||
, cronMonth = Some (T.MDYPat.Single m)
|
||||
, cronDay = Some (T.MDYPat.Single d)
|
||||
// { cpYear = Some (T.MDYPat.Single y)
|
||||
, cpMonth = Some (T.MDYPat.Single m)
|
||||
, cpDay = Some (T.MDYPat.Single d)
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -109,11 +109,11 @@ let partN =
|
|||
let toSplit =
|
||||
\(x : PartSplit) ->
|
||||
nullSplit (T.EntryAcntGetter.ConstT x._1) c
|
||||
// { sValue = Some (T.EntryNumGetter.ConstN x._2)
|
||||
, sComment = x._3
|
||||
// { eValue = Some (T.EntryNumGetter.ConstN x._2)
|
||||
, eComment = x._3
|
||||
}
|
||||
|
||||
in [ nullSplit a c // { sComment = comment } ]
|
||||
in [ nullSplit a c // { eComment = comment } ]
|
||||
# List/map PartSplit T.EntryGetter.Type toSplit ss
|
||||
|
||||
let part1 =
|
||||
|
|
Loading…
Reference in New Issue