query
On this page

setFunctionArgs

lib.trivial.setFunctionArgs

Docs pulled from | This Revision | 11 minutes ago


Add metadata about expected function arguments to a function. The metadata should match the format given by builtins.functionArgs, i.e. a set from expected argument to a bool representing whether that argument has a default or not. setFunctionArgs : (a → b) → Map String Bool → (a → b)

This function is necessary because you can't dynamically create a function of the { a, b ? foo, ... }: format, but some facilities like callPackage expect to be able to query expected arguments.

Inputs

f

1. Function argument

args

2. Function argument


Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

setFunctionArgs = f: args:
    { # TODO: Should we add call-time "type" checking like built in?
      __functor = self: f;
      __functionArgs = args;
    };