lib: mkIfElse

main
Zynh Ludwig 2024-08-24 19:51:44 -07:00
parent 2540156e17
commit f4ec471ef5
1 changed files with 6 additions and 1 deletions

View File

@ -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)
];
}