summary refs log tree commit diff
path: root/pkgs/os-specific/linux/nftables
diff options
context:
space:
mode:
authorDanylo Hlynskyi <abcz2.uprola@gmail.com>2019-08-18 18:47:57 +0300
committerGitHub <noreply@github.com>2019-08-18 18:47:57 +0300
commitd09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3 (patch)
tree0080515df4c61351ef9efd573e867a768e05b0dc /pkgs/os-specific/linux/nftables
parenta2ea2a1945df9f164d1bdfffc1efbefd2f139b6b (diff)
parentd80cd26ff981f1c4be96b82757811b21f280f1a6 (diff)
downloadnixpkgs-d09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3.tar
nixpkgs-d09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3.tar.gz
nixpkgs-d09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3.tar.bz2
nixpkgs-d09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3.tar.lz
nixpkgs-d09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3.tar.xz
nixpkgs-d09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3.tar.zst
nixpkgs-d09b4e3c87e744f90f4d44eb2b2f3fa92912b7c3.zip
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
Diffstat (limited to 'pkgs/os-specific/linux/nftables')
0 files changed, 0 insertions, 0 deletions