Put NAtom as expression
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
Synopsis
- value mkConst
- value mkNull
- value mkBool
- value mkInt
- value mkFloat
- value mkStr
- value mkIndentedStr
- value mkPath
- value mkEnvPath
- value mkRelPath
- value mkSym
- value mkSynHole
- value mkSelector
- value mkApp
- value mkOp
- value mkNot
- value mkNeg
- value mkOp2
- value mkParamSet
- value mkVariadicParamSet
- value mkNamedParamSet
- value mkNamedVariadicParamSet
- value mkGeneralParamSet
- value mkRecSet
- value mkNonRecSet
- value mkSet
- value emptySet
- value mkList
- value emptyList
- value mkLets
- value mkWith
- value mkAssert
- value mkIf
- value mkFunction
- value getRefOrDefault
- value mkNullF
- value mkBoolF
- value mkIntF
- value mkFloatF
- value mkPathF
- value mkEnvPathF
- value mkRelPathF
- value mkSymF
- value mkSynHoleF
- value inheritFrom
- value inherit
- value $=
- value bindTo
- value appendBindings
- value modifyFunctionBody
- value letsE
- value letE
- value attrsE
- value recAttrsE
- value @.
- value @.<|>
- value @@
- value $++
- value $*
- value $/
- value $+
- value $-
- value $//
- value $>
- value $>=
- value $<=
- value $<
- value $==
- value $!=
- value $&&
- value $||
- value $->
- value ==>
- value mkOper
- value mkOper2
- value mkBinop
- value mkParamset
- Packagehnix-0.17.0
- Exports77
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceShorthands.hs
Basic expression builders
Put null.
Put boolean.
Put integer.
Put floating point number.
Put a regular (double-quoted) string.
Put an indented string.
Put a path. Use True if the path should be read from the environment, else use False.
Put a path expression which pulls from the NIX_PATH env variable.
Put a path which references a relative path.
Put a variable (symbol).
Put syntactic hole.
Put a binary operator. @since
Put an unary operator.
Logical negation: not.
Number negation: -.
Negation in the language works with integers and floating point. @since 0.15.0
Put a binary operator. @since 0.15.0
{ x }{ x, ... }s@{ x }s@{ x, ... }Args:
Maybe name:
Nothing -> {}
Just "s" -> s@{}key:expr pairs
Is variadic or not:
True -> {...}
False -> {}rec { .. }Put a non-recursive set.
{ .. }General set builder function.
Empty set.
Monoid. Use // operation (shorthand $//) to extend the set.
@since 0.15.0
Put a list.
Wrap in a let.
(Evaluate the second argument after introducing the bindings.)
Haskell | Nix |
|---|---|
|
|
Create a whith:
1st expr - what to bring into the scope.
2nd - expression that recieves the scope extention.
Haskell | Nix |
|---|---|
|
|
Create an assert:
1st expr - asserting itself, must return true.
2nd - main expression to evaluated after assertion.
Haskell | Nix |
|---|---|
|
|
Put:
if expr1
then expr2
else expr3Lambda function, analog of Haskell's \ x -> x:
Haskell | Nix |
|---|---|
|
|
General dot-reference with optional alternative if the key does not exist. @since 0.15.0
Base functor builders for basic expressions builders *sic
Unfixed mkNull.
Unfixed mkBool.
Unfixed mkInt.
Unfixed mkFloat.
Unfixed mkPath.
Unfixed mkEnvPath.
Unfixed mkRelPath.
Unfixed mkSym.
Unfixed mkSynHole.
Other
An inherit clause with an expression to pull from.
Hask | Nix | pseudocode |
|---|---|---|
|
|
|
An inherit clause without an expression to pull from.
Hask | Nix | pseudocode |
|---|---|---|
|
|
|
Nix = (bind operator).
Shorthand for producing a binding of a name to an expression: Nix's =.
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`.
Applies a transformation to the body of a Nix function.
A let statement with multiple assignments.
Wrapper for a single-variable let.
Make a non-recursive attribute set.
Make a recursive attribute set.
Nix binary operators
Dot-reference into an attribute set: attrSet.k
Dot-reference into an attribute set with alternative if the key does not exist.
s.x or yFunction application (' ' in f x)
List concatenation: ++
Multiplication: *
Division: /
Addition: +
Subtraction: -
Extendoverride the left attr set, with the right one: @/@
Greater than: >
Greater than OR equal: >=
Less than OR equal: <=
Less than: <
Equality: ==
Inequality: !=
AND: &&
OR: ||
Logical implication: ->
Lambda function, analog of Haskell's \ x -> x:
Haskell | Nix |
|---|---|
|
|
Under deprecation
Deprecated: Please, use mkOp
Put an unary operator.
Deprecated: Please, use mkOp2
| Put a binary operator.
Deprecated: Please, use mkOp2
| Nix binary operator builder.
Deprecated: Please, use:
* mkParamSet is for closed sets;
* mkVariadicSet is for variadic;
* mkGeneralParamSet a general constructor.