1
1
mirror of https://github.com/coot/free-category.git synced 2024-11-23 09:55:43 +03:00
free-category/default.nix
Marcin Szamotulski 20d61b2355
Efficient representation of a free category (#5)
* Efficient representation of free category

Using type aligned real time queues (Okasaki, 'Purely Functional Data
Structures') to represent catanable type allign lists (free categories).

Composition is O(1) and right fold is O(n), where n is number of
transitions.

* Bump version to 0.0.3

Make it compile on ghc802.

* Updated CI configuration
2019-08-31 08:12:21 +00:00

47 lines
1.6 KiB
Nix

{ compiler ? "ghc865"
, haddock ? true
, test ? true
, benchmarks ? false
, dev ? true
}:
with builtins;
let
nixpkgs = import ./nix/nixpkgs.nix { inherit compiler; };
pkgs = nixpkgs.haskell.packages;
lib = nixpkgs.haskell.lib;
callCabal2nix = nixpkgs.haskell.packages.${compiler}.callCabal2nix;
doHaddock = if haddock
then lib.doHaddock
else lib.dontHaddock;
doTest = if test
then lib.doCheck
else lib.dontCheck;
doBench = if benchmarks
then lib.doBenchmark
else nixpkgs.lib.id;
doDev = if dev
then drv: lib.appendConfigureFlag drv "--ghc-option -Werror"
else nixpkgs.lib.id;
docNoSeprateOutput = drv: lib.overrideCabal drv (drv: { enableSeparateDocOutput = false; });
srcFilter = src: path: type:
let relPath = nixpkgs.lib.removePrefix (toString src + "/") (toString path);
in
nixpkgs.lib.hasPrefix "src" relPath
|| nixpkgs.lib.hasPrefix "test" relPath
|| nixpkgs.lib.any
(a: a == relPath)
[ "Setup.hs" "cabal.project" "ChangeLog.md" "free-category.cabal" "LICENSE"];
free-category = docNoSeprateOutput(doDev(doHaddock(doTest(doBench(
lib.overrideCabal (callCabal2nix "free-category" ./. {})
(drv: {src = nixpkgs.lib.cleanSourceWith { filter = srcFilter drv.src; src = drv.src; };})
)))));
examples = docNoSeprateOutput(doDev(doHaddock(doTest(doBench(
lib.overrideCabal (callCabal2nix "examples" ./examples { inherit free-category; })
(drv: {src = nixpkgs.lib.sourceFilesBySuffices drv.src [ ".hs" "LICENSE" "ChangeLog.md" "examples.cabal" ];})
)))));
in { inherit free-category examples; }