1: { withArgs }:
2:
3: with builtins;
4:
5: # Return an eta-expanded wrapper around "g", which accepts the same named
6: # arguments as "f".
7: f: g:
8: with { fArgs = functionArgs f; };
9: withArgs (filter (n: !fArgs."${n}") (attrNames fArgs)) g