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 "") ]
|
++ [ (raw "") ]
|
||||||
);
|
);
|
||||||
pipe = join ".";
|
pipe = join ".";
|
||||||
|
pipe1 = lft: rgt: pipe [ lft rgt ];
|
||||||
spaceBetween = join " ";
|
spaceBetween = join " ";
|
||||||
|
|
||||||
wrap = start: end: expr:
|
wrap = start: end: expr:
|
||||||
|
@ -74,7 +75,9 @@ let
|
||||||
|
|
||||||
call = fnName: args:
|
call = fnName: args:
|
||||||
concat [ (validFuncName fnName) (wrapParen (join ", " 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_and = raw "and";
|
||||||
kw_or = raw "or";
|
kw_or = raw "or";
|
||||||
|
@ -127,6 +130,7 @@ let
|
||||||
++ body
|
++ body
|
||||||
++ [ kw_end ])
|
++ [ kw_end ])
|
||||||
);
|
);
|
||||||
|
lambda = func "";
|
||||||
|
|
||||||
return = expr: spaceBetween ([ kw_return expr ]);
|
return = expr: spaceBetween ([ kw_return expr ]);
|
||||||
return_void = return null;
|
return_void = return null;
|
||||||
|
@ -204,6 +208,8 @@ in
|
||||||
# useful aliases
|
# useful aliases
|
||||||
var = raw;
|
var = raw;
|
||||||
vars = map raw;
|
vars = map raw;
|
||||||
|
inherit call0 call1;
|
||||||
|
inherit lambda;
|
||||||
|
|
||||||
inherit validString;
|
inherit validString;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue