ENH update types

This commit is contained in:
Nathan Dwarshuis 2023-04-30 22:54:20 -04:00
parent 0650ce1948
commit ca7fef7a56
2 changed files with 60 additions and 60 deletions

View File

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

View File

@ -20,7 +20,7 @@ let d_ = dec2 False
let nullSplit = let nullSplit =
\(a : T.EntryAcntGetter) -> \(a : T.EntryAcntGetter) ->
\(c : T.EntryCurGetter) -> \(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::{=} let nullOpts = T.TxOpts::{=}
@ -41,9 +41,9 @@ let cron1 =
\(d : Natural) -> \(d : Natural) ->
T.DatePat.Cron T.DatePat.Cron
( nullCron ( nullCron
// { cronYear = Some (T.MDYPat.Single y) // { cpYear = Some (T.MDYPat.Single y)
, cronMonth = Some (T.MDYPat.Single m) , cpMonth = Some (T.MDYPat.Single m)
, cronDay = Some (T.MDYPat.Single d) , cpDay = Some (T.MDYPat.Single d)
} }
) )
@ -109,11 +109,11 @@ let partN =
let toSplit = let toSplit =
\(x : PartSplit) -> \(x : PartSplit) ->
nullSplit (T.EntryAcntGetter.ConstT x._1) c nullSplit (T.EntryAcntGetter.ConstT x._1) c
// { sValue = Some (T.EntryNumGetter.ConstN x._2) // { eValue = Some (T.EntryNumGetter.ConstN x._2)
, sComment = x._3 , eComment = x._3
} }
in [ nullSplit a c // { sComment = comment } ] in [ nullSplit a c // { eComment = comment } ]
# List/map PartSplit T.EntryGetter.Type toSplit ss # List/map PartSplit T.EntryGetter.Type toSplit ss
let part1 = let part1 =