pwncash/dhall/common.dhall

176 lines
4.1 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) ->
\(c : T.EntryCurGetter) ->
T.ToEntryGetter::{ eAcnt = a, eCurrency = c, eTags = [] : List T.TagID }
let nullOpts = T.TxOpts::{=}
let nullVal = T.ValMatcher::{=}
let nullMatch = T.StatementParser::{=}
let nullCron = T.CronPat::{=}
let nullMod =
\(by : Natural) ->
\(u : T.TimeUnit) ->
T.ModPat::{ mpBy = by, mpUnit = u }
let cron1 =
\(y : Natural) ->
\(m : Natural) ->
\(d : Natural) ->
T.DatePat.Cron
( nullCron
// { cpYear = Some (T.MDYPat.Single y)
, cpMonth = Some (T.MDYPat.Single m)
, cpDay = Some (T.MDYPat.Single d)
}
)
let matchInf_ = nullMatch
let matchInf = \(x : T.TxGetter) -> nullMatch // { spTx = Some x }
let matchN_ = \(n : Natural) -> nullMatch // { spTimes = Some n }
let matchN =
\(n : Natural) -> \(x : T.TxGetter) -> 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 partN =
\(c : T.EntryCurGetter) ->
\(a : T.EntryAcntGetter) ->
\(comment : Text) ->
\(ss : List PartEntry) ->
let toEntry =
\(x : PartEntry) ->
nullEntry (T.EntryAcntGetter.ConstT x._1) c
// { eValue = Some (T.EntryNumGetter.ConstN x._2)
, eComment = x._3
}
in [ nullEntry a c // { eComment = comment } ]
# List/map PartEntry T.ToEntryGetter.Type toEntry ss
let part1 =
\(c : T.EntryCurGetter) ->
\(a : T.EntryAcntGetter) ->
\(comment : Text) ->
partN c a comment ([] : List PartEntry)
let part1_ =
\(c : T.EntryCurGetter) ->
\(a : T.EntryAcntGetter) ->
partN c a "" ([] : List PartEntry)
let addDay =
\(x : T.GregorianM) ->
\(d : Natural) ->
{ gYear = x.gmYear, gMonth = x.gmMonth, gDay = d }
let mvP = nullVal // { vmSign = Some True }
let mvN = nullVal // { vmSign = Some False }
let mvNum = \(x : Natural) -> nullVal // { vmNum = Some x }
let mvDen = \(x : Natural) -> nullVal // { 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 { nullEntry
, nullMatch
, nullVal
, nullOpts
, nullCron
, nullMod
, cron1
, mY
, mYM
, mYMD
, mRngY
, mRngYM
, mRngYMD
, matchInf_
, matchInf
, matchN_
, matchN
, match1_
, match1
, greg
, gregM
, partN
, part1
, part1_
, addDay
, comma = 44
, tab = 9
, mvP
, mvN
, mvNum
, mvNumP
, mvNumN
, mvDen
, mvDenP
, mvDenN
, PartEntry
}
/\ T