pwncash/dhall/common.dhall

191 lines
4.4 KiB
Plaintext

let List/map =
https://prelude.dhall-lang.org/v21.1.0/List/map
sha256:dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680
let T =
./Types.dhall
sha256:49fae993de77c82248b3a53a7237ee06542331e969b185cc943a56746247d4e1
let nullSplit =
\(a : T.SplitAcnt) ->
\(c : T.SplitCur) ->
T.ExpSplit::{ sAcnt = a, sCurrency = c }
let nullOpts = T.TxOpts::{=}
let nullVal = T.MatchVal::{=}
let nullMatch = T.Match::{=}
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
// { cronYear = Some (T.MDYPat.Single y)
, cronMonth = Some (T.MDYPat.Single m)
, cronDay = Some (T.MDYPat.Single d)
}
)
let matchInf_ = nullMatch
let matchInf = \(x : T.ToTx) -> nullMatch // { mTx = Some x }
let matchN_ = \(n : Natural) -> nullMatch // { mTimes = Some n }
let matchN =
\(n : Natural) -> \(x : T.ToTx) -> matchInf x // { mTimes = 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.MatchDate.On (T.MatchYMD.Y y)
let mYM =
\(y : Natural) ->
\(m : Natural) ->
T.MatchDate.On (T.MatchYMD.YM (gregM y m))
let mYMD =
\(y : Natural) ->
\(m : Natural) ->
\(d : Natural) ->
T.MatchDate.On (T.MatchYMD.YMD (greg y m d))
let mRngY =
\(y : Natural) ->
\(r : Natural) ->
T.MatchDate.In { _1 = T.MatchYMD.Y y, _2 = r }
let mRngYM =
\(y : Natural) ->
\(m : Natural) ->
\(r : Natural) ->
T.MatchDate.In { _1 = T.MatchYMD.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 }
let PartSplit = { _1 : T.AcntID, _2 : T.Decimal, _3 : Text }
let partN =
\(c : T.SplitCur) ->
\(a : T.SplitAcnt) ->
\(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 }
in [ nullSplit a c // { sComment = comment } ]
# List/map PartSplit T.ExpSplit.Type toSplit ss
let part1 =
\(c : T.SplitCur) ->
\(a : T.SplitAcnt) ->
\(comment : Text) ->
partN c a comment ([] : List PartSplit)
let part1_ =
\(c : T.SplitCur) ->
\(a : T.SplitAcnt) ->
partN c a "" ([] : List PartSplit)
let dec =
\(s : Bool) ->
\(w : Natural) ->
\(d : Natural) ->
\(p : Natural) ->
{ whole = w, decimal = d, precision = p, sign = s } : T.Decimal
let dec2 = \(s : Bool) -> \(w : Natural) -> \(d : Natural) -> dec s w d 2
let d = dec2 True
let d_ = dec2 False
let addDay =
\(x : T.GregorianM) ->
\(d : Natural) ->
{ gYear = x.gmYear, gMonth = x.gmMonth, gDay = d }
let mvP = nullVal // { mvSign = Some True }
let mvN = nullVal // { mvSign = Some False }
let mvNum = \(x : Natural) -> nullVal // { mvNum = Some x }
let mvDen = \(x : Natural) -> nullVal // { mvDen = Some x }
let mvNumP = \(x : Natural) -> mvP // { mvNum = Some x }
let mvNumN = \(x : Natural) -> mvN // { mvNum = Some x }
let mvDenP = \(x : Natural) -> mvP // { mvDen = Some x }
let mvDenN = \(x : Natural) -> mvN // { mvDen = Some x }
in { nullSplit
, nullMatch
, nullVal
, nullOpts
, nullCron
, nullMod
, cron1
, mY
, mYM
, mYMD
, mRngY
, mRngYM
, mRngYMD
, matchInf_
, matchInf
, matchN_
, matchN
, match1_
, match1
, greg
, gregM
, partN
, part1
, part1_
, d
, d_
, addDay
, comma = 44
, tab = 9
, mvP
, mvN
, mvNum
, mvNumP
, mvNumN
, mvDen
, mvDenP
, mvDenN
, PartSplit
}
/\ T