2009-02-09 17:51:03 +01:00
|
|
|
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;
|
2009-07-02 10:58:30 +02:00
|
|
|
mergeAttrs = x: y: x // y;
|
2009-02-09 17:51:03 +01:00
|
|
|
|
|
|
|
# Take a function and evaluate it with its own returned value.
|
|
|
|
fix = f: let result = f result; in result;
|
|
|
|
|
2009-10-23 09:00:15 +02:00
|
|
|
# Flip argument order
|
|
|
|
flip = f: x: y: f y x;
|
2009-02-09 17:51:03 +01:00
|
|
|
}
|