dhall-nix-lib/Any/update.dhall

33 lines
895 B
Text

λ(nix : ../NixPrelude.dhall) →
let Any = ./Type.dhall
let Set = ../Set/Type.dhall
let Number = ../Number/Type.dhall
let Any/toTypeUnchecked = ./toTypeUnchecked.dhall nix
let Any/subtract = ./subtract.dhall nix
let Any/toAny = ./toAny.dhall nix
let lastElem =
λ(x : List Any) →
nix.builtins.elemAt
x
( Any/toTypeUnchecked
Natural
( Any/toAny
Number
( Any/subtract
(Any/toAny Natural (nix.builtins.length x))
(Any/toAny Natural 1)
)
)
)
in λ(e1 : Any) →
λ(e2 : Any) →
nix.builtins.zipAttrsWith
(λ(name : Text) → λ(values : List Any) → lastElem values)
[ Any/toTypeUnchecked Set e1, Any/toTypeUnchecked Set e2 ]