add aliases for call, pipe and func"
This commit is contained in:
parent
98eaf7a9c2
commit
6f94ad4a53
1 changed files with 7 additions and 1 deletions
8
lib.nix
8
lib.nix
|
@ -66,6 +66,7 @@ let
|
|||
++ [ (raw "") ]
|
||||
);
|
||||
pipe = join ".";
|
||||
pipe1 = lft: rgt: pipe [ lft rgt ];
|
||||
spaceBetween = join " ";
|
||||
|
||||
wrap = start: end: expr:
|
||||
|
@ -74,7 +75,9 @@ let
|
|||
|
||||
call = fnName: args:
|
||||
concat [ (validFuncName fnName) (wrapParen (join ", " args)) ];
|
||||
require = name: call "require" [ name ];
|
||||
call0 = call [ ];
|
||||
call1 = arg: call [ arg ];
|
||||
require = name: call1 "require" name;
|
||||
|
||||
kw_and = raw "and";
|
||||
kw_or = raw "or";
|
||||
|
@ -127,6 +130,7 @@ let
|
|||
++ body
|
||||
++ [ kw_end ])
|
||||
);
|
||||
lambda = func "";
|
||||
|
||||
return = expr: spaceBetween ([ kw_return expr ]);
|
||||
return_void = return null;
|
||||
|
@ -204,6 +208,8 @@ in
|
|||
# useful aliases
|
||||
var = raw;
|
||||
vars = map raw;
|
||||
inherit call0 call1;
|
||||
inherit lambda;
|
||||
|
||||
inherit validString;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue