toFunction
lib.toFunction
Docs pulled from | This Revision | 13 minutes ago
Turns any non-callable values into constant functions. Returns callable values as is.
Inputs
v
-
Any value
Examples
lib.trivial.toFunction
usage example
nix-repl> lib.toFunction 1 2
1
nix-repl> lib.toFunction (x: x + 1) 2
3
Noogle detected
Implementation
The following is the current implementation of this function.
toFunction =
v:
if isFunction v
then v
else k: v;