···867nix-build -A haskell.packages.integer-simple.ghc802.scientific
868```
86900000000000000000000000000000000000000000000000000000000870## Other resources
871872 - The Youtube video [Nix Loves Haskell](https://www.youtube.com/watch?v=BsBhi_r-OeE)
···867nix-build -A haskell.packages.integer-simple.ghc802.scientific
868```
869870+### Quality assurance
871+872+The `haskell.lib` library includes a number of functions for checking for
873+various imperfections in Haskell packages. It's useful to apply these functions
874+to your own Haskell packages and integrate that in a Continuous Integration
875+server like [hydra](https://nixos.org/hydra/) to assure your packages maintain a
876+minimum level of quality. This section discusses some of these functions.
877+878+#### buildStrictly
879+880+Applying `haskell.lib.buildStrictly` to a Haskell package enables the `-Wall`
881+and `-Werror` GHC options to turn all warnings into build failures. Additionally
882+the source of your package is gotten from first invoking `cabal sdist` to ensure
883+all needed files are listed in the Cabal file.
884+885+#### checkUnusedPackages
886+887+Applying `haskell.lib.checkUnusedPackages` to a Haskell package invokes
888+the [packunused](http://hackage.haskell.org/package/packunused) tool on the
889+package. `packunused` complains when it finds packages listed as build-depends
890+in the Cabal file which are redundant. For example:
891+892+```
893+$ nix-build -E 'let pkgs = import <nixpkgs> {}; in pkgs.haskell.lib.checkUnusedPackages {} pkgs.haskellPackages.scientific'
894+these derivations will be built:
895+ /nix/store/3lc51cxj2j57y3zfpq5i69qbzjpvyci1-scientific-0.3.5.1.drv
896+...
897+detected package components
898+~~~~~~~~~~~~~~~~~~~~~~~~~~~
899+900+ - library
901+ - testsuite(s): test-scientific
902+ - benchmark(s): bench-scientific*
903+904+(component names suffixed with '*' are not configured to be built)
905+906+library
907+~~~~~~~
908+909+The following package dependencies seem redundant:
910+911+ - ghc-prim-0.5.0.0
912+913+testsuite(test-scientific)
914+~~~~~~~~~~~~~~~~~~~~~~~~~~
915+916+no redundant packages dependencies found
917+918+builder for ‘/nix/store/3lc51cxj2j57y3zfpq5i69qbzjpvyci1-scientific-0.3.5.1.drv’ failed with exit code 1
919+error: build of ‘/nix/store/3lc51cxj2j57y3zfpq5i69qbzjpvyci1-scientific-0.3.5.1.drv’ failed
920+```
921+922+As you can see, `packunused` finds out that although the testsuite component has
923+no redundant dependencies the library component of `scientific-0.3.5.1` depends
924+on `ghc-prim` which is unused in the library.
925+926## Other resources
927928 - The Youtube video [Nix Loves Haskell](https://www.youtube.com/watch?v=BsBhi_r-OeE)
+17-1
pkgs/development/haskell-modules/lib.nix
···1# TODO(@Ericson2314): Remove `pkgs` param, which is only used for
2-# `buildStackProject` and `justStaticExecutables`
3{ pkgs, lib }:
45rec {
···107 });
108109 buildStrictly = pkg: buildFromSdist (appendConfigureFlag pkg "--ghc-option=-Wall --ghc-option=-Werror");
0000000000000000110111 buildStackProject = pkgs.callPackage ./generic-stack-builder.nix { };
112