diff options
author | tv <tv@krebsco.de> | 2015-07-26 21:04:13 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2015-07-26 21:13:50 +0200 |
commit | fc7e21f0af3b75248f78e47138c32dbb61370061 (patch) | |
tree | 53749a8110f16cc9573dccef9ec9c0978cdc449e /4lib/krebs/tree.nix | |
parent | 5877e9c94a64afb5c9df19aca2d9b1aeff3700b2 (diff) |
3 krebs: make dns.providers part of api
Diffstat (limited to '4lib/krebs/tree.nix')
-rw-r--r-- | 4lib/krebs/tree.nix | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/4lib/krebs/tree.nix b/4lib/krebs/tree.nix new file mode 100644 index 0000000..1cd83b3 --- /dev/null +++ b/4lib/krebs/tree.nix @@ -0,0 +1,13 @@ +{ lib, ... }: + +with lib; + +rec { + # tree k v = set k (either v (tree k v)) + + # get : [k] -> tree k v -> v + get = path: tree: + if length path > 0 + then get (tail path) tree.${head path} # TODO check if elem exists + else tree; +} |