diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-08-14 14:00:44 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-08-14 14:00:44 +0000 |
commit | 9279174dde3e1a450e63e866d2683352dd8238d3 (patch) | |
tree | 05b5b835f143b97d150a37873641fb5d5e9a7075 /src/libexpr/nixexpr-ast.def | |
parent | db4f4a842515392a6b40f5c86b2ef885c1278451 (diff) |
* Added an experimental feature suggested by Andres: ellipses ("...")
in attribute set pattern matches. This allows defining a function
that takes *at least* the listed attributes, while ignoring
additional attributes. For instance,
{stdenv, fetchurl, fuse, ...}:
stdenv.mkDerivation {
...
};
defines a function that requires an attribute set that contains the
specified attributes but ignores others. The main advantage is that
we can then write in all-packages.nix
aefs = import ../bla/aefs pkgs;
instead of
aefs = import ../bla/aefs {
inherit stdenv fetchurl fuse;
};
This saves a lot of typing (not to mention not having to update
all-packages.nix with purely mechanical changes). It saves as much
typing as the "args: with args;" style, but has the advantage that
the function arguments are properly declared (not implicit in what
the body of the "with" uses).
Diffstat (limited to 'src/libexpr/nixexpr-ast.def')
-rw-r--r-- | src/libexpr/nixexpr-ast.def | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libexpr/nixexpr-ast.def b/src/libexpr/nixexpr-ast.def index 670db1976..ab749b3db 100644 --- a/src/libexpr/nixexpr-ast.def +++ b/src/libexpr/nixexpr-ast.def @@ -66,7 +66,7 @@ PrimOp | int ATermBlob ATermList | Expr | Attrs | ATermList | Expr | Closed | Expr | Expr | Rec | ATermList ATermList | Expr | -Bool | ATerm | Expr | +Bool | ATermBool | Expr | Null | | Expr | Bind | string Expr Pos | ATerm | @@ -76,7 +76,7 @@ Inherit | Expr ATermList Pos | ATerm | Scope | | Expr | VarPat | string | Pattern | -AttrsPat | ATermList | Pattern | +AttrsPat | ATermList ATermBool | Pattern | # bool = `...' AtPat | Pattern Pattern | Pattern | Formal | string DefaultValue | ATerm | @@ -84,8 +84,8 @@ Formal | string DefaultValue | ATerm | DefaultValue | Expr | DefaultValue | NoDefaultValue | | DefaultValue | -True | | ATerm | -False | | ATerm | +True | | ATermBool | +False | | ATermBool | PrimOpDef | int ATermBlob | ATerm | |