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:
|
||||
let
|
||||
inherit (prev) isFunction;
|
||||
inherit (prev) isFunction mkMerge mkIf;
|
||||
in
|
||||
rec {
|
||||
# Ternary operator
|
||||
|
@ -15,4 +15,9 @@ rec {
|
|||
right = f: g: tern (isFunction g)
|
||||
(right (x: f (g (x))))
|
||||
(f (g));
|
||||
|
||||
mkIfElse = predicate: yes: no: mkMerge [
|
||||
(mkIf predicate yes)
|
||||
(mkIf (!predicate) no)
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue