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: a2ea2a1945df
Choose a base ref
...
head repository: NixOS/nixpkgs
compare: d09b4e3c87e7
Choose a head ref
  • 10 commits
  • 20 files changed
  • 1 contributor

Commits on Jul 14, 2019

  1. lib: introduce foreach = flip map

    The main purpose is to bring attention to `flip map`, which improves
    code readablity. It is useful when ad-hoc anonymous function
    grows two or more lines in `map` application:
    
    ```
          map (lcfg:
            let port = lcfg.port;
                portStr = if port != defaultPort then ":${toString port}" else "";
                scheme = if cfg.enableSSL then "https" else "http";
            in "${scheme}://cfg.hostName${portStr}"
          ) (getListen cfg);
    ```
    Compare this to `foreach`-style:
    ```
          foreach (getListen cfg) (lcfg:
            let port = lcfg.port;
                portStr = if port != defaultPort then ":${toString port}" else "";
                scheme = if cfg.enableSSL then "https" else "http";
            in "${scheme}://cfg.hostName${portStr}"
          );
    ```
    This is similar to Haskell's `for` (http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Traversable.html#v:for)
    danbst committed Jul 14, 2019
    Copy the full SHA
    69920da View commit details
    Browse the repository at this point in the history
  2. mass replace "flip map -> foreach"

    See `foreach`-introduction commit.
    ```
    rg 'flip map ' --files-with-matches | xargs sed -i 's/flip map /foreach /g'
    ```
    danbst committed Jul 14, 2019
    Copy the full SHA
    3b05343 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2019

  1. Revert "mass replace "flip map -> foreach""

    This reverts commit 3b05343.
    danbst committed Aug 5, 2019
    Copy the full SHA
    91bb646 View commit details
    Browse the repository at this point in the history
  2. mass replace "flip map -> forEach"

    See `forEach`-introduction commit.
    ```
    rg 'flip map ' --files-with-matches | xargs sed -i 's/flip map /forEach /g'
    ```
    danbst committed Aug 5, 2019
    Copy the full SHA
    0f8596a View commit details
    Browse the repository at this point in the history
  3. rename foreach -> forEach

    danbst committed Aug 5, 2019
    Copy the full SHA
    d041336 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    7585496 View commit details
    Browse the repository at this point in the history
  5. and one more place

    danbst committed Aug 5, 2019
    Copy the full SHA
    210c578 View commit details
    Browse the repository at this point in the history
  6. add release notes

    danbst committed Aug 5, 2019
    Copy the full SHA
    29ba0a0 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2019

  1. Copy the full SHA
    d80cd26 View commit details
    Browse the repository at this point in the history
  2. lib: introduce forEach = flip map (#64723)

    * lib: introduce `foreach` = flip map
    
    The main purpose is to bring attention to `flip map`, which improves
    code readablity. It is useful when ad-hoc anonymous function
    grows two or more lines in `map` application:
    
    ```
          map (lcfg:
            let port = lcfg.port;
                portStr = if port != defaultPort then ":${toString port}" else "";
                scheme = if cfg.enableSSL then "https" else "http";
            in "${scheme}://cfg.hostName${portStr}"
          ) (getListen cfg);
    ```
    Compare this to `foreach`-style:
    ```
          foreach (getListen cfg) (lcfg:
            let port = lcfg.port;
                portStr = if port != defaultPort then ":${toString port}" else "";
                scheme = if cfg.enableSSL then "https" else "http";
            in "${scheme}://cfg.hostName${portStr}"
          );
    ```
    This is similar to Haskell's `for` (http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Traversable.html#v:for)
    
    * mass replace "flip map -> foreach"
    
    See `foreach`-introduction commit.
    ```
    rg 'flip map ' --files-with-matches | xargs sed -i 's/flip map /foreach /g'
    ```
    
    * Revert "mass replace "flip map -> foreach""
    
    This reverts commit 3b05343.
    
    * mass replace "flip map -> forEach"
    
    See `forEach`-introduction commit.
    ```
    rg 'flip map ' --files-with-matches | xargs sed -i 's/flip map /forEach /g'
    ```
    
    * rename foreach -> forEach
    
    * and one more place
    
    * add release notes
    danbst committed Aug 18, 2019
    Copy the full SHA
    d09b4e3 View commit details
    Browse the repository at this point in the history