39 lines
605 B
Nix
39 lines
605 B
Nix
{ lib, ... }:
|
|
rec {
|
|
/**
|
|
# Type
|
|
|
|
```
|
|
mapListToAttrs :: (a -> { name :: String; value :: b; }) -> [a] -> { ${name} :: b; }
|
|
```
|
|
*/
|
|
mapListToAttrs =
|
|
f:
|
|
list:
|
|
lib.listToAttrs (map f list);
|
|
|
|
/**
|
|
# Type
|
|
|
|
```
|
|
mapNamesToAttrs :: (${name} -> a) -> [${name}] -> { ${name} :: a; }
|
|
```
|
|
*/
|
|
mapNamesToAttrs =
|
|
f:
|
|
list:
|
|
mapListToAttrs (name: { inherit name; value = f name; });
|
|
|
|
/**
|
|
# Type
|
|
|
|
```
|
|
mapNamesToAttrsConst :: a -> [${name}] -> { ${name} :: a; }
|
|
```
|
|
*/
|
|
mapNamesToAttrsConst =
|
|
a:
|
|
list:
|
|
mapNamesToAttrs (_: a);
|
|
}
|