From d664b8f5e3aeff8d6cf826d103bca342a7cf81c2 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 12 Oct 2018 15:22:41 -0400 Subject: nixpkgs docs: document mapAttrsRecursiveCond --- doc/functions/library/attrsets.xml | 123 +++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) (limited to 'doc') diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml index 5d8182cc6097..7a8ce95fd030 100644 --- a/doc/functions/library/attrsets.xml +++ b/doc/functions/library/attrsets.xml @@ -1049,4 +1049,127 @@ mapAttrsRecursive ]]> + +
+ <function>lib.attrsets.mapAttrsRecursiveCond</function> + + mapAttrsRecursiveCond :: (AttrSet -> Bool) -> ([ String ] -> Any -> Any) -> AttrSet -> AttrSet + + + + + + Like mapAttrsRecursive, but it takes an additional + predicate function that tells it whether to recursive into an attribute set. + If it returns false, mapAttrsRecursiveCond does not + recurse, but does apply the map function. It is returns true, it does + recurse, and does not apply the map function. + + + + + + cond + + + + (AttrSet -> Bool) + + + Determine if mapAttrsRecursive should recurse deeper + in to the attribute set. + + + + + attributeset + + + + An attribute set. + + + + + + + + + f + + + + [ String ] -> Any -> Any + + + Given a list of attribute names and value, return a new value. + + + + + name_path + + + + The list of attribute names to this value. + + + For example, the name_path for the + example string in the attribute set { foo + = { bar = "example"; }; } is [ "foo" "bar" + ]. + + + + + + value + + + + The attribute's value. + + + + + + + + + set + + + + The attribute set to recursively map over. + + + + + + + Only convert attribute values to JSON if the containing attribute set is marked for recursion + { + dorecur = { + hello = "\"there\""; + recurse = "true"; + }; + dontrecur = "{\"converted-to\":\"json\"}"; + } + ]]> + +
+ -- cgit 1.4.1