Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
base: 360e57a567a7
Choose a base ref
...
head repository: NixOS/nixpkgs
compare: 8252861507ef
Choose a head ref
  • 1 commit
  • 3 files changed
  • 2 contributors

Commits on Oct 21, 2019

  1. 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>
    Profpatsch and infinisil committed Oct 21, 2019
    Copy the full SHA
    8252861 View commit details
    Browse the repository at this point in the history