lib: mkIfElse
This commit is contained in:
parent
2540156e17
commit
f4ec471ef5
1 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
final: prev:
|
final: prev:
|
||||||
let
|
let
|
||||||
inherit (prev) isFunction;
|
inherit (prev) isFunction mkMerge mkIf;
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
# Ternary operator
|
# Ternary operator
|
||||||
|
@ -15,4 +15,9 @@ rec {
|
||||||
right = f: g: tern (isFunction g)
|
right = f: g: tern (isFunction g)
|
||||||
(right (x: f (g (x))))
|
(right (x: f (g (x))))
|
||||||
(f (g));
|
(f (g));
|
||||||
|
|
||||||
|
mkIfElse = predicate: yes: no: mkMerge [
|
||||||
|
(mkIf predicate yes)
|
||||||
|
(mkIf (!predicate) no)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue