HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Modulehnix-0.17.0Haskell2010

Nix.Expr.Shorthands

Shorthands for making Nix expressions.

Functions with an F suffix return a more general type (base functor F a) without the outer Fix wrapper that creates a.

Contents
  1. Basic expression builders
  2. Base functor builders for basic expressions builders *sic
  3. Other
  4. Nix binary operators
  5. Under deprecation
Synopsis
  • Packagehnix-0.17.0
  • Exports77
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceShorthands.hs

Basic expression builders

valuemkNeg :: NExpr -> NExpr

Number negation: -.

Negation in the language works with integers and floating point. @since 0.15.0

valueemptySet :: NExpr

Empty set.

Monoid. Use // operation (shorthand $//) to extend the set. @since 0.15.0

valuemkLets :: [Binding NExpr] -> NExpr -> NExpr

Wrap in a let.

(Evaluate the second argument after introducing the bindings.)

Haskell

Nix

mkLets bindings expr

let bindings;

in expr

valuemkWith :: NExpr -> NExpr -> NExpr

Create a whith: 1st expr - what to bring into the scope. 2nd - expression that recieves the scope extention.

Haskell

Nix

mkWith body main

with body; expr

valuemkAssert :: NExpr -> NExpr -> NExpr

Create an assert: 1st expr - asserting itself, must return true. 2nd - main expression to evaluated after assertion.

Haskell

Nix

mkAssert check eval

assert check; eval

Base functor builders for basic expressions builders *sic

Other

valueinherit :: [VarName] -> Binding e

An inherit clause without an expression to pull from.

Hask

Nix

pseudocode

inheritFrom [a, b]

inherit a b;

a = outside.a;

b = outside.b;

Append a list of bindings to a set or let expression. For example: adding `[a = 1, b = 2]` to `let c = 3; in 4` produces `let a = 1; b = 2; c = 3; in 4`.

Nix binary operators

Under deprecation