nixpkgs/lib
Profpatsch 8252861507 lib/trivial: add pipe function
`pipe` is a useful operator for creating pipelines of functions.

It works around the usual problem of e.g. string operations becoming
deeply nested functions.

In principle, there are four different ways this function could be
written:

pipe val [ f1 .. fn ]
pipe val [ fn .. f1 ]
compose [ f1 .. fn ] val
compose [ fn .. f1 ] val

The third and fourth form mirror composition of functions, they would
be the same as e.g. `(f1 << f2 << f3 .. << fn) val`.
However, it is not clear which direction the list should have (as one
can see in the second form, which is the most absurd.

In order not to confuse users, we decide for the most “intuitive”
form, which mirrors the way unix pipes work (thus the name `pipe`).
The flow of data goes from left to right.

Co-Authored-By: Silvan Mosberger <infinisil@icloud.com>
2019-10-21 13:19:16 +02:00
..
systems
tests lib/trivial: add pipe function 2019-10-21 13:19:16 +02:00
asserts.nix
attrsets.nix
customisation.nix
debug.nix
default.nix lib/trivial: add pipe function 2019-10-21 13:19:16 +02:00
deprecated.nix
fetchers.nix
filesystem.nix
fixed-points.nix
generators.nix
kernel.nix
licenses.nix
lists.nix
meta.nix
minver.nix
modules.nix
options.nix
sources.nix
strings-with-deps.nix
strings.nix
trivial.nix lib/trivial: add pipe function 2019-10-21 13:19:16 +02:00
types.nix
versions.nix
zip-int-bits.nix