mirror of
https://github.com/NixOS/nix.git
synced 2025-11-13 05:56:03 +01:00
* Refactoring: combine functions that take an attribute set and
functions that take a single argument (plain lambdas) into one AST node (Function) that contains a Pattern node describing the arguments. Current patterns are single lazy arguments (VarPat) and matching against an attribute set (AttrsPat). This refactoring allows other kinds of patterns to be added easily, such as Haskell-style @-patterns, or list pattern matching.
This commit is contained in:
parent
c03b729319
commit
efe4b690ae
12 changed files with 184 additions and 148 deletions
|
|
@ -3,8 +3,7 @@ init initNixExprHelpers
|
|||
Pos | string int int | Pos |
|
||||
NoPos | | Pos |
|
||||
|
||||
Function | ATermList Expr Pos | Expr |
|
||||
Function1 | string Expr Pos | Expr |
|
||||
Function | Pattern Expr Pos | Expr |
|
||||
Assert | Expr Expr Pos | Expr |
|
||||
With | Expr Expr Pos | Expr |
|
||||
If | Expr Expr Expr | Expr |
|
||||
|
|
@ -76,6 +75,9 @@ Inherit | Expr ATermList Pos | ATerm |
|
|||
|
||||
Scope | | Expr |
|
||||
|
||||
VarPat | string | Pattern |
|
||||
AttrsPat | ATermList | Pattern |
|
||||
|
||||
Formal | string DefaultValue | ATerm |
|
||||
|
||||
DefaultValue | Expr | DefaultValue |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue