Param (Single Parameter)
Single parameter constructor for function parameters. Part of the Params type.
Definition
Param VarName
Fields
| Field | Type | Description |
|---|---|---|
contents | VarName | The parameter name |
Description
Param represents a single-argument function parameter like x: x + 1. This is distinct from ParamSet which represents { x, y }: ....
Nix Source ↔ AST
# Nix
x: x + 1
# AST
{
"tag": "Abs",
"params": { "tag": "Param", "contents": "x" },
"body": {
"tag": "Binary",
"op": "+",
"left": { "tag": "Sym", "contents": "x" },
"right": { "tag": "Constant", "contents": { "tag": "Int", "contents": 1 } }
}
}
Related
Nix Library Access
syntax.mkParam "x"