HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

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.

  • 77 values
  • Packagehnix-0.17.0
  • Exports77
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceShorthands.hs

Basic expression builders

35 declarations
valuemkPath :: Bool -> FilePath -> NExpr
#

Put a path. Use True if the path should be read from the environment, else use False.

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

10 declarations
valueinheritFrom :: e -> [VarName] -> Binding e
#

An inherit clause with an expression to pull from.

Hask

Nix

pseudocode

inheritFrom x [a, b]

inherit (x) a b;

a = x.a;

b = x.b;

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;

valueappendBindings :: [Binding NExpr] -> NExpr -> NExpr
#

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

19 declarations
value(@.) :: NExpr -> Text -> NExpr
#

Dot-reference into an attribute set: attrSet.k

value(@.<|>) :: NExpr -> Text -> NExpr -> NExpr
#

Dot-reference into an attribute set with alternative if the key does not exist.

s.x or y
value($//) :: NExpr -> NExpr -> NExpr
#

Extendoverride the left attr set, with the right one: @/@

Under deprecation

4 declarations