nixpkgs/lib
danbst 69920dafbf 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)
2019-07-14 13:29:58 +03:00
..
systems Revert "Revert "systems/doubles.nix: add Apple doubles"" 2019-07-10 15:14:59 -04:00
tests make-tarball / lib-tests: reduce duplication 2019-07-11 18:02:05 +02:00
asserts.nix lib: move assertMsg and assertOneOf to their own library file 2018-09-06 18:14:27 +02:00
attrsets.nix bundlerEnv: ensure dependencies always included 2018-12-11 21:26:07 +00:00
customisation.nix lib: tiny cleanup 2019-02-03 15:30:15 +00:00
debug.nix lib/debug: Update documentation comments for docs generation 2018-10-29 10:45:25 +01:00
default.nix lib: introduce foreach = flip map 2019-07-14 13:29:58 +03:00
deprecated.nix lib: add shortcuts for fake hashes (fakeSha256, fakeSha512) 2019-01-10 19:27:35 +02:00
fetchers.nix Convert libs to a fixed-point 2017-09-16 21:36:43 -04:00
filesystem.nix Convert libs to a fixed-point 2017-09-16 21:36:43 -04:00
fixed-points.nix lib.converge: optimise 2019-04-17 15:55:57 +01:00
generators.nix treewide: Remove usage of isNull 2019-04-29 14:05:50 +02:00
kernel.nix linux: convert hardened-config to a structured one 2019-01-28 09:07:24 +09:00
licenses.nix licenses: refer to libpng2 using spdx 2019-06-12 22:04:52 +00:00
lists.nix lib: introduce foreach = flip map 2019-07-14 13:29:58 +03:00
meta.nix lib: implement setPrio 2018-11-22 08:59:48 +00:00
minver.nix Nix minimal version: 1.11 -> 2.0 2018-08-30 08:09:54 -04:00
modules.nix module system: revert "remove types.optionSet", just deprecate (#56857) 2019-03-07 21:28:09 +02:00
options.nix module system: prettify a bit error when unique option defined twice 2019-06-05 03:10:57 +03:00
sources.nix treewide: Remove usage of isNull 2019-04-29 14:05:50 +02:00
strings-with-deps.nix Convert libs to a fixed-point 2017-09-16 21:36:43 -04:00
strings.nix Doc fix: use correct function name in type signature for concatIMapStringsSep 2019-03-18 12:14:39 +00:00
trivial.nix treewide: Remove usage of isNull 2019-04-29 14:05:50 +02:00
types.nix module system: revert "remove types.optionSet", just deprecate (#56857) 2019-03-07 21:28:09 +02:00
versions.nix lib: add versions library 2018-03-04 06:28:34 -08:00
zip-int-bits.nix lib/trivial: move zipIntBits to its own file 2018-07-26 20:36:45 +02:00