Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Param (Single Parameter)

Single parameter constructor for function parameters. Part of the Params type.

Definition

Param VarName

Fields

FieldTypeDescription
contentsVarNameThe 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 } }
  }
}

Nix Library Access

syntax.mkParam "x"