nix-helpers: 35db17377a0b1f832c5b525177ef3d9a0b98646c

     1: { lib }:
     2: 
     3: with builtins;
     4: with lib;
     5: 
     6: # Return an eta-expanded wrapper around "f", which accepts the named
     7: # arguments "args".
     8: # TODO: Hopefully Nix will get a feature to set a function's argument names
     9: args: f:
    10: 
    11: with rec {
    12: 
    13:   # Build a string "a,b,c" for the arguments "args"
    14:   arglist = concatStringsSep "," args;
    15: 
    16:   # Strip any dependencies off our string, so it can be embedded
    17:   arglistF = unsafeDiscardStringContext arglist;
    18: 
    19:   # Write an eta-expansion of "f", which accepts the arguments "args"
    20:   content = "f: args@{${arglistF}, ...}: f args";
    21: 
    22:   eta = import (toFile "withArgs.nix" content) f;
    23: };
    24: eta

Generated by git2html.