ENH update common

This commit is contained in:
Nathan Dwarshuis 2023-04-30 11:52:30 -04:00
parent 4098e72060
commit d7c61ac293
2 changed files with 26 additions and 23 deletions

View File

@ -557,7 +557,7 @@ let StatementParser_ =
, mVal = ValMatcher::{=}
, mDesc = None Text
, mOther = [] : List (FieldMatcher_ re)
, mTx = None EntryGetter.Type
, mTx = None TxGetter
, mTimes = None Natural
, mPriority = +0
}
@ -1024,4 +1024,5 @@ in { CurID
, TaxValue
, BudgetTransferValue
, BudgetTransferType
, TxGetter
}

View File

@ -18,15 +18,15 @@ let d = dec2 True
let d_ = dec2 False
let nullSplit =
\(a : T.SplitAcnt) ->
\(c : T.SplitCur) ->
T.ExpSplit::{ sAcnt = a, sCurrency = c, sTags = [] : List T.TagID }
\(a : T.EntryAcntGetter) ->
\(c : T.EntryCurGetter) ->
T.EntryGetter::{ sAcnt = a, sCurrency = c, sTags = [] : List T.TagID }
let nullOpts = T.TxOpts::{=}
let nullVal = T.MatchVal::{=}
let nullVal = T.ValMatcher::{=}
let nullMatch = T.Match::{=}
let nullMatch = T.StatementParser::{=}
let nullCron = T.CronPat::{=}
@ -49,12 +49,12 @@ let cron1 =
let matchInf_ = nullMatch
let matchInf = \(x : T.ToTx) -> nullMatch // { mTx = Some x }
let matchInf = \(x : T.TxGetter) -> nullMatch // { mTx = Some x }
let matchN_ = \(n : Natural) -> nullMatch // { mTimes = Some n }
let matchN =
\(n : Natural) -> \(x : T.ToTx) -> matchInf x // { mTimes = Some n }
\(n : Natural) -> \(x : T.TxGetter) -> matchInf x // { mTimes = Some n }
let match1_ = matchN_ 1
@ -68,61 +68,63 @@ let greg =
\(d : Natural) ->
{ gYear = y, gMonth = m, gDay = d }
let mY = \(y : Natural) -> T.MatchDate.On (T.MatchYMD.Y y)
let mY = \(y : Natural) -> T.DateMatcher.On (T.YMDMatcher.Y y)
let mYM =
\(y : Natural) ->
\(m : Natural) ->
T.MatchDate.On (T.MatchYMD.YM (gregM y m))
T.DateMatcher.On (T.YMDMatcher.YM (gregM y m))
let mYMD =
\(y : Natural) ->
\(m : Natural) ->
\(d : Natural) ->
T.MatchDate.On (T.MatchYMD.YMD (greg y m d))
T.DateMatcher.On (T.YMDMatcher.YMD (greg y m d))
let mRngY =
\(y : Natural) ->
\(r : Natural) ->
T.MatchDate.In { _1 = T.MatchYMD.Y y, _2 = r }
T.DateMatcher.In { _1 = T.YMDMatcher.Y y, _2 = r }
let mRngYM =
\(y : Natural) ->
\(m : Natural) ->
\(r : Natural) ->
T.MatchDate.In { _1 = T.MatchYMD.YM (gregM y m), _2 = r }
T.DateMatcher.In { _1 = T.YMDMatcher.YM (gregM y m), _2 = r }
let mRngYMD =
\(y : Natural) ->
\(m : Natural) ->
\(d : Natural) ->
\(r : Natural) ->
T.MatchDate.In { _1 = T.MatchYMD.YMD (greg y m d), _2 = r }
T.DateMatcher.In { _1 = T.YMDMatcher.YMD (greg y m d), _2 = r }
let PartSplit = { _1 : T.AcntID, _2 : T.Decimal, _3 : Text }
let partN =
\(c : T.SplitCur) ->
\(a : T.SplitAcnt) ->
\(c : T.EntryCurGetter) ->
\(a : T.EntryAcntGetter) ->
\(comment : Text) ->
\(ss : List PartSplit) ->
let toSplit =
\(x : PartSplit) ->
nullSplit (T.SplitAcnt.ConstT x._1) c
// { sValue = Some (T.SplitNum.ConstN x._2), sComment = x._3 }
nullSplit (T.EntryAcntGetter.ConstT x._1) c
// { sValue = Some (T.EntryNumGetter.ConstN x._2)
, sComment = x._3
}
in [ nullSplit a c // { sComment = comment } ]
# List/map PartSplit T.ExpSplit.Type toSplit ss
# List/map PartSplit T.EntryGetter.Type toSplit ss
let part1 =
\(c : T.SplitCur) ->
\(a : T.SplitAcnt) ->
\(c : T.EntryCurGetter) ->
\(a : T.EntryAcntGetter) ->
\(comment : Text) ->
partN c a comment ([] : List PartSplit)
let part1_ =
\(c : T.SplitCur) ->
\(a : T.SplitAcnt) ->
\(c : T.EntryCurGetter) ->
\(a : T.EntryAcntGetter) ->
partN c a "" ([] : List PartSplit)
let addDay =