From 29c0199d5c53cec59cfb44c94a4c9651b1c034b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 30 Dec 2015 08:42:41 +0100 Subject: [PATCH] manual: document builtins.functionArgs The text is just a conversion of comment from src/libexpr/primops.cc --- doc/manual/expressions/builtins.xml | 20 +++++++++++++++++++- src/libexpr/primops.cc | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 3b664479d..40d90f78d 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -335,7 +335,7 @@ stdenv.mkDerivation { - builtins.foldl’ + builtins.foldl’ op nul list Reduce a list by applying a binary operator, from @@ -348,6 +348,24 @@ stdenv.mkDerivation { + builtins.functionArgs + f + + + Return a set containing the names of the formal arguments expected + by the function f. + The value of each attribute is a Boolean denoting whether the corresponding + argument has a default value. For instance, + functionArgs ({ x, y ? 123}: ...) = { x = false; y = true; }. + + + "Formal argument" here refers to the attributes pattern-matched by + the function. Plain lambdas are not included, e.g. + functionArgs (x: ...) = { }. + + + + builtins.fromJSON e Convert a JSON string to a Nix diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 5b9ecc018..cf2d3d278 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1154,7 +1154,7 @@ static void prim_catAttrs(EvalState & state, const Pos & pos, Value * * args, Va /* Return a set containing the names of the formal arguments expected by the function `f'. The value of each attribute is a Boolean - denoting whether has a default value. For instance, + denoting whether the corresponding argument has a default value. For instance, functionArgs ({ x, y ? 123}: ...) => { x = false; y = true; }