aboutsummaryrefslogtreecommitdiff
path: root/tests/lang/eval-okay-patterns.exp
AgeCommit message (Collapse)Author
2010-04-21* Update the expected test output (no longer an ATerm).Eelco Dolstra
2010-03-25* Simplify @-patterns: only `{attrs}@name' or `name@{attrs}' are nowEelco Dolstra
allowed. So `name1@name2', `{attrs1}@{attrs2}' and so on are now no longer legal. This is no big loss because they were not useful anyway. This also changes the output of builtins.toXML for @-patterns slightly.
2008-08-14* Added an experimental feature suggested by Andres: ellipses ("...")Eelco Dolstra
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).
2008-08-14* @-patterns as in Haskell. For instance, in a function definitionEelco Dolstra
f = args @ {x, y, z}: ...; `args' refers to the argument as a whole, which is further pattern-matched against the attribute set pattern {x, y, z}.