on iko/ghcjs-patch-master help sign in
Equivalent to collectComponents with (_: true) as selection function (#438)

* Add collectComponents': collectComponents with (_: true) as selection function. * Fix location of checks in documentation.

commite346ccbef81f6e8f1179fdac472b4a0f131046e9 authorJean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io> dateSun 9 Feb 2020, 09:56 (7 years ago) parentb09db52
2 files changed+16−3
docs/reference/library.md+7−3 lib/default.nix+9
docs/reference/library.md+7−3
@@ -281,17 +281,21 @@ Assorted functions for operating on [Haskell.nix][] data. This is
281281distinct from `pkgs.haskell.lib` in the current Nixpkgs Haskell
282282Infrastructure.
283283
284−### collectComponents
284+### collectComponents and collectComponents'
285285
286286Extracts a selection of components from a Haskell [package set](#package-set).
287287
288288This can be used to filter out all test suites or benchmarks of
289289your project, so that they can be built in Hydra (see check if you
290−waht to run the tests as well as build them).
290+want to run the tests as well as build them).
291+
292+`collectComponents'` is an alias of `collectComponents` without
293+predicate for filtering.
291294
292295```
293296collectComponents =
294297 group: packageSel: haskellPackages: ...
298+collectComponents' = group: collectComponents (_: true)
295299```
296300
297301
@@ -321,7 +325,7 @@ This function turns a derivation that builds a test into one to run it.
321325| `drv` | Derivation | One of `$pkg.components.tests.$test`. |
322326
323327For convenience `$pkg.components.tests` are mapped with this function
324−to `$pkg.components.checks`.
328+to `$pkg.checks`.
325329
326330This function is intended for use with `tests` but it should also work
327331for `exes` and `benchmarks` if you just want to run them to make sure
lib/default.nix+9
@@ -143,6 +143,15 @@ with haskellLib;
143143 (lib.filterAttrs (name: package: (package.isHaskell or false) && packageSel package) haskellPackages))
144144 // { recurseForDerivations = true; };
145145
146+ # Equivalent to collectComponents with (_: true) as selection function.
147+ # Useful for pre-filtered package-set.
148+ #
149+ # For example:
150+ #
151+ # myHaskellPackages = selectProjectPackages hsPkgs;
152+ # myTests = collectComponents' "tests" myHaskellPackages;
153+ collectComponents' = group: collectComponents group (_: true);
154+
146155 # Replacement for lib.cleanSourceWith that has a subDir argument.
147156 inherit (import ./clean-source-with.nix { inherit lib; }) cleanSourceWith canCleanSource;
148157