aboutsummaryrefslogtreecommitdiff
path: root/bin/tests/data/faster_groupby.nix
blob: 30d1031f91251bdf4cd692c1ddc24870fcb4af3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  # trivial case
  _ = lib.groupBy (x: if x > 2 then "big" else "small") [ 1 2 3 4 5 ];

  # offer lint heuristically on this too
  _ = nixpkgs.lib.groupBy (x: if x > 2 then "big" else "small") [ 1 2 3 4 5 ];

  # do not lint on `builtins`
  _ = builtins.groupBy (x: x.name) [
    { name = "foo"; idx = 1; }
    { name = "foo"; idx = 2; }
    { name = "bar"; idx = 1; }
    { name = "bar"; idx = 2; }
  ];
}