dhall-nix-lib/Set/toMap.dhall

31 lines
908 B
Text

λ(nix : ../NixPrelude.dhall) →
let Any = ../Any/Type.dhall
let Set = ./Type.dhall
let Map =
https://prelude.dhall-lang.org/Map/Type.dhall
sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed
let Entry =
https://prelude.dhall-lang.org/Map/Entry.dhall
sha256:f334283bdd9cd88e6ea510ca914bc221fc2dab5fb424d24514b2e0df600d5346
let List/map =
https://prelude.dhall-lang.org/List/map.dhall
sha256:dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680
let setToMap
: Set → Map Text Any
= λ(set : Set) →
let attrs = nix.builtins.attrNames set
in List/map
Text
(Entry Text Any)
( λ(k : Text) →
{ mapKey = k, mapValue = nix.builtins.getAttr k set }
)
attrs
in setToMap