Add a 'functionTo x' type.
This is mainly to for the 'merge' concept, but I made a guess as to what iter and fold would mean for functions.
This commit is contained in:
parent
bbffdd4702
commit
ce6d4070a6
|
@ -176,6 +176,19 @@ rec {
|
||||||
fold = op: nul: v: if v == null then nul else elemType.fold op nul v;
|
fold = op: nul: v: if v == null then nul else elemType.fold op nul v;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
functionTo = elemType: mkOptionType {
|
||||||
|
name = "function that evaluates to a(n) ${elemType.name}";
|
||||||
|
check = lib.traceValIfNot builtins.isFunction;
|
||||||
|
merge = fns:
|
||||||
|
args: elemType.merge (map (fn: fn args) fns)
|
||||||
|
# These are guesses, I don't fully understand iter, fold, delayOnGlobalEval
|
||||||
|
iter = f: path: v:
|
||||||
|
args: elemType.iter f path (v args);
|
||||||
|
fold = op: nul: v:
|
||||||
|
args: elemType.fold op nul (v args);
|
||||||
|
inherit (elemType) hasOptions delayOnGlobalEval;
|
||||||
|
};
|
||||||
|
|
||||||
# !!! this should be a type constructor that takes the options as
|
# !!! this should be a type constructor that takes the options as
|
||||||
# an argument.
|
# an argument.
|
||||||
optionSet = mkOptionType {
|
optionSet = mkOptionType {
|
||||||
|
|
Loading…
Reference in New Issue