mapCrossIndex
lib.mapCrossIndex
Docs pulled from | This Revision | about 1 hour ago
Takes a function and applies it pointwise to each field of a cross index.
A cross index (short for "Cross Platform Pair Index") is a 6-field structure organizing values by cross-compilation platform relationships.
Inputs
f- Function to apply to each cross index value
crossIndex- A cross index to transform
Type
mapCrossIndex :: (a -> b) -> {
buildBuild :: a;
buildHost :: a;
buildTarget :: a;
hostHost :: a;
hostTarget :: a;
targetTarget :: a;
} -> {
buildBuild :: b;
buildHost :: b;
buildTarget :: b;
hostHost :: b;
hostTarget :: b;
targetTarget :: b;
}
Examples
lib.customisation.mapCrossIndex usage example
mapCrossIndex (x: x * 10) { buildBuild = 1; buildHost = 2; ... }
=> { buildBuild = 10; buildHost = 20; ... }
# Extract a package from package sets
mapCrossIndex (pkgs: pkgs.hello) crossIndexedPackageSets
Noogle detected
Implementation
The following is the current implementation of this function.
mapCrossIndex =
f:
{
buildBuild,
buildHost,
buildTarget,
hostHost,
hostTarget,
targetTarget,
}:
{
buildBuild = f buildBuild;
buildHost = f buildHost;
buildTarget = f buildTarget;
hostHost = f hostHost;
hostTarget = f hostTarget;
targetTarget = f targetTarget;
};