summary refs log blame commit diff
path: root/pkgs/lib/trivial.nix
blob: a4fbd164fe57bb2305b2924bd40a1bb60ec097e2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                
rec {

  # Identity function.
  id = x: x;

  # Constant function.
  const = x: y: x;

  # Named versions corresponding to some builtin operators.
  concat = x: y: x ++ y;
  or = x: y: x || y;
  and = x: y: x && y;
  mergeAttrs = x : y : x // y;
  
  # Take a function and evaluate it with its own returned value.
  fix = f: let result = f result; in result;

}