163 lines
3.9 KiB
Plaintext
163 lines
3.9 KiB
Plaintext
let List/map =
|
|
https://prelude.dhall-lang.org/v21.1.0/List/map
|
|
sha256:dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680
|
|
|
|
let T = ./Types.dhall
|
|
|
|
let nullEntry =
|
|
\(a : T.EntryAcntGetter) ->
|
|
\(v : T.EntryNumGetter) ->
|
|
T.FromEntryGetter::{ eAcnt = a, eValue = v }
|
|
|
|
let nullMod =
|
|
\(by : Natural) ->
|
|
\(u : T.TimeUnit) ->
|
|
T.ModPat::{ mpBy = by, mpUnit = u }
|
|
|
|
let cron1 =
|
|
\(y : Natural) ->
|
|
\(m : Natural) ->
|
|
\(d : Natural) ->
|
|
T.DatePat.Cron
|
|
T.CronPat::{
|
|
, cpYear = Some (T.MDYPat.Single y)
|
|
, cpMonth = Some (T.MDYPat.Single m)
|
|
, cpDay = Some (T.MDYPat.Single d)
|
|
}
|
|
|
|
let matchInf_ = T.StatementParser::{=}
|
|
|
|
let matchInf = \(x : T.TxGetter.Type) -> T.StatementParser::{ spTx = Some x }
|
|
|
|
let matchN_ = \(n : Natural) -> T.StatementParser::{ spTimes = Some n }
|
|
|
|
let matchN =
|
|
\(n : Natural) ->
|
|
\(x : T.TxGetter.Type) ->
|
|
matchInf x // { spTimes = Some n }
|
|
|
|
let match1_ = matchN_ 1
|
|
|
|
let match1 = matchN 1
|
|
|
|
let gregM = \(y : Natural) -> \(m : Natural) -> { gmYear = y, gmMonth = m }
|
|
|
|
let greg =
|
|
\(y : Natural) ->
|
|
\(m : Natural) ->
|
|
\(d : Natural) ->
|
|
{ gYear = y, gMonth = m, gDay = d }
|
|
|
|
let mY = \(y : Natural) -> T.DateMatcher.On (T.YMDMatcher.Y y)
|
|
|
|
let mYM =
|
|
\(y : Natural) ->
|
|
\(m : Natural) ->
|
|
T.DateMatcher.On (T.YMDMatcher.YM (gregM y m))
|
|
|
|
let mYMD =
|
|
\(y : Natural) ->
|
|
\(m : Natural) ->
|
|
\(d : Natural) ->
|
|
T.DateMatcher.On (T.YMDMatcher.YMD (greg y m d))
|
|
|
|
let mRngY =
|
|
\(y : Natural) ->
|
|
\(r : Natural) ->
|
|
T.DateMatcher.In { _1 = T.YMDMatcher.Y y, _2 = r }
|
|
|
|
let mRngYM =
|
|
\(y : Natural) ->
|
|
\(m : Natural) ->
|
|
\(r : Natural) ->
|
|
T.DateMatcher.In { _1 = T.YMDMatcher.YM (gregM y m), _2 = r }
|
|
|
|
let mRngYMD =
|
|
\(y : Natural) ->
|
|
\(m : Natural) ->
|
|
\(d : Natural) ->
|
|
\(r : Natural) ->
|
|
T.DateMatcher.In { _1 = T.YMDMatcher.YMD (greg y m d), _2 = r }
|
|
|
|
let PartEntry = { _1 : T.AcntID, _2 : Double, _3 : Text }
|
|
|
|
let partNFrom =
|
|
\(ss : List PartEntry) ->
|
|
let toEntry =
|
|
\(x : PartEntry) ->
|
|
T.FromEntryGetter::{
|
|
, eAcnt = T.EntryAcntGetter.ConstT x._1
|
|
, eValue = T.EntryNumGetter.ConstN x._2
|
|
, eComment = x._3
|
|
}
|
|
|
|
in List/map PartEntry T.FromEntryGetter.Type toEntry ss
|
|
|
|
let partNTo =
|
|
\(ss : List PartEntry) ->
|
|
let toEntry =
|
|
\(x : PartEntry) ->
|
|
T.ToEntryGetter::{
|
|
, eAcnt = T.EntryAcntGetter.ConstT x._1
|
|
, eValue =
|
|
T.LinkedEntryNumGetter.Getter (T.EntryNumGetter.ConstN x._2)
|
|
, eComment = x._3
|
|
}
|
|
|
|
in List/map PartEntry T.ToEntryGetter.Type toEntry ss
|
|
|
|
let addDay =
|
|
\(x : T.GregorianM) ->
|
|
\(d : Natural) ->
|
|
{ gYear = x.gmYear, gMonth = x.gmMonth, gDay = d }
|
|
|
|
let mvP = T.ValMatcher::{ vmSign = Some True }
|
|
|
|
let mvN = T.ValMatcher::{ vmSign = Some False }
|
|
|
|
let mvNum = \(x : Natural) -> T.ValMatcher::{ vmNum = Some x }
|
|
|
|
let mvDen = \(x : Natural) -> T.ValMatcher::{ vmDen = Some x }
|
|
|
|
let mvNumP = \(x : Natural) -> mvP // { vmNum = Some x }
|
|
|
|
let mvNumN = \(x : Natural) -> mvN // { vmNum = Some x }
|
|
|
|
let mvDenP = \(x : Natural) -> mvP // { vmDen = Some x }
|
|
|
|
let mvDenN = \(x : Natural) -> mvN // { vmDen = Some x }
|
|
|
|
in { cron1
|
|
, mY
|
|
, mYM
|
|
, mYMD
|
|
, mRngY
|
|
, mRngYM
|
|
, mRngYMD
|
|
, matchInf_
|
|
, matchInf
|
|
, matchN_
|
|
, matchN
|
|
, match1_
|
|
, match1
|
|
, greg
|
|
, gregM
|
|
, partNFrom
|
|
, partNTo
|
|
, addDay
|
|
, comma = 44
|
|
, tab = 9
|
|
, mvP
|
|
, mvN
|
|
, mvNum
|
|
, mvNumP
|
|
, mvNumN
|
|
, mvDen
|
|
, mvDenP
|
|
, mvDenN
|
|
, PartEntry
|
|
, nullEntry
|
|
, nullMod
|
|
}
|
|
/\ T
|