NamedVar { attrPath :: AttrPath, value :: Expr }
| Field | Type | Description |
attrPath | AttrPath | Attribute path (non-empty list of KeyName) |
value | Expr | The bound expression |
# Nix
x = 1;
# AST
{
"tag": "NamedVar",
"attrPath": [{ "tag": "StaticKey", "contents": "x" }],
"value": { "tag": "Constant", "contents": { "tag": "Int", "contents": 1 } }
}
# Nix
a.b.c = 1;
# AST
{
"tag": "NamedVar",
"attrPath": [
{ "tag": "StaticKey", "contents": "a" },
{ "tag": "StaticKey", "contents": "b" },
{ "tag": "StaticKey", "contents": "c" }
],
"value": { "tag": "Constant", "contents": { "tag": "Int", "contents": 1 } }
}
# Nix
let name = "foo"; in { ${name} = 1; }
# AST
{
"tag": "NamedVar",
"attrPath": [
{ "tag": "DynamicKey", "contents": {
"tag": "Antiquoted",
"contents": { "tag": "Sym", "contents": "name" }
}
}
],
"value": { "tag": "Constant", "contents": { "tag": "Int", "contents": 1 } }
}
syntax.mkNamedVar [syntax.mkStaticKey "x"] (syntax.mkInt 1)
syntax.mkNamedVar [syntax.mkStaticKey "a", syntax.mkStaticKey "b"] (syntax.mkInt 1)