nixpkgs/pkgs
Danylo Hlynskyi d09b4e3c87
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 3b0534310c89d04fc3a9c5714b5a4d0f9fb0efca.

* 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
2019-08-18 18:47:57 +03:00
..
applications lib: introduce forEach = flip map (#64723) 2019-08-18 18:47:57 +03:00
build-support Merge master into staging-next 2019-08-17 09:30:16 +02:00
common-updater
data Merge master into staging-next 2019-08-17 09:30:16 +02:00
desktops gnome3.evolution-data-server: Fix gsettings-desktop-schemas path 2019-08-12 18:32:12 +02:00
development Merge pull request #66358 from Ralith/openxr-loader 2019-08-18 16:25:45 +02:00
games Merge pull request #66800 from r-ryantm/auto-update/cutemaze 2019-08-18 16:15:32 +02:00
misc vimPlugins: update (#66749) 2019-08-17 12:06:45 +02:00
os-specific Merge pull request #66802 from r-ryantm/auto-update/conky 2019-08-18 09:43:04 +02:00
servers Merge pull request #66657 from danbst/pgpackages-fixes 2019-08-18 17:30:56 +03:00
shells zsh/pth/zsync: cross fixes (#65780) 2019-08-14 07:15:01 +01:00
stdenv Merge pull request #66657 from danbst/pgpackages-fixes 2019-08-18 17:30:56 +03:00
test
tools Merge branch 'master' into flip-map-foreach 2019-08-18 18:00:25 +03:00
top-level Merge pull request #66657 from danbst/pgpackages-fixes 2019-08-18 17:30:56 +03:00