-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libexpr: experimental pipe operators
- Loading branch information
Showing
10 changed files
with
162 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
synopsis: "Add `pipe-operators` experimental feature" | ||
prs: | ||
- 11131 | ||
--- | ||
|
||
This is a draft implementation of [RFC 0148](https://github.com/NixOS/rfcs/pull/148). | ||
|
||
The `pipe-operators` experimental feature adds `<|` and `|>` operators to the Nix language. | ||
*a* `|>` *b* is equivalent to the function application *b* *a*, and | ||
*a* `<|` *b* is equivalent to the function application *a* *b*. | ||
|
||
For example: | ||
|
||
``` | ||
nix-repl> 1 |> builtins.add 2 |> builtins.mul 3 | ||
9 | ||
nix-repl> builtins.add 1 <| builtins.mul 2 <| 3 | ||
7 | ||
``` | ||
|
||
`<|` and `|>` are right and left associative, respectively, and have lower precedence than any other operator. | ||
These properties may change in future releases. | ||
|
||
See [the RFC](https://github.com/NixOS/rfcs/pull/148) for more examples and rationale. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: experimental Nix feature 'pipe-operators' is disabled; add '--extra-experimental-features pipe-operators' to enable it | ||
at /pwd/lang/eval-fail-pipe-operators.nix:1:3: | ||
1| 1 |> 2 | ||
| ^ | ||
2| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |> 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters