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

App (Function Application)

Definition

App { func :: Expr, arg :: Expr }

Fields

FieldTypeDescription
funcExprThe function expression being applied
argExprThe argument expression

Nix Source ↔ AST

# Nix
f x

# AST
{
  "tag": "App",
  "func": { "tag": "Sym", "contents": "f" },
  "arg": { "tag": "Sym", "contents": "x" }
}

Chained Application

# Nix
f x y

# AST (left-associative)
{
  "tag": "App",
  "func": {
    "tag": "App",
    "func": { "tag": "Sym", "contents": "f" },
    "arg": { "tag": "Sym", "contents": "x" }
  },
  "arg": { "tag": "Sym", "contents": "y" }
}

Nix Library Access

syntax.mkApp (syntax.mkSym "f") (syntax.mkSym "x")