diff --git a/myShell.nix b/myShell.nix new file mode 100644 index 0000000..4d3be4f --- /dev/null +++ b/myShell.nix @@ -0,0 +1,57 @@ +let + +myHaskellPackageOverlay = self: super: { + + myHaskellPackages = super.haskellPackages.override { + overrides = hself: hsuper: rec { + + cas-store = self.haskell.lib.overrideCabal self.haskellPackages.cas-store (old: { libraryHaskellDepends = old.libraryHaskellDepends ++ [ self.haskellPackages.kqueue ]; }); + + funflow = super.haskell.lib.dontCheck (hself.callHackage "funflow" "1.5.0" {}); + + funflow-nix = super.haskell.lib.dontCheck hsuper.funflow-nix; + + + }; + }; +}; + +in + +{ nixpkgs ? import { config.allowBroken = true; + overlays = [ myHaskellPackageOverlay ]; + }, + compiler ? "default", + doBenchmark ? false }: + +let + + inherit (nixpkgs) pkgs; + + f = { mkDerivation, base, containers, data-default, funflow + , funflow-nix, Glob, lib, path, path-io, time, unix + }: + mkDerivation { + pname = "map-scraper"; + version = "0.1.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + base containers data-default funflow funflow-nix Glob path path-io + time unix + ]; + license = lib.licenses.bsd3; + }; + + haskellPackages = if compiler == "default" + then pkgs.haskellPackages + else pkgs.haskell.packages.${compiler}; + + variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; + + drv = variant (pkgs.myHaskellPackages.callPackage f {}); + +in + + if pkgs.lib.inNixShell then drv.env else drv diff --git a/shell.nix b/shell.nix index ff5d563..a2fd30e 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ let np = import {}; in - np.mkShell { buildInputs = [np.haskell.packages.ghc822.ghc]; } + np.mkShell { buildInputs = [np.haskell.packages.ghc8104.ghc]; } diff --git a/src/Main.hs b/src/Main.hs index 5e3e617..fb5be08 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -3,6 +3,8 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TupleSections #-} +{-# OPTIONS_GHC -Wall -Wno-type-defaults #-} + module Main where import Control.Arrow @@ -57,7 +59,7 @@ partitionA f = proc xs -> That d -> ((second (partitionA f)) >>> arr (\(d, (cs, ds)) -> (cs, d:ds))) -< (d, ys) These c d -> (second (partitionA f)) >>> arr (\((c, d), (cs, ds)) -> (c:cs, d:ds)) -< ((c, d), ys) -boolChoice :: ArrowFlow eff ex a => a CS.Item (These CS.Item (Content Dir)) +boolChoice :: (ArrowFlow eff ex a, ArrowChoice a) => a CS.Item (These CS.Item (Content Dir)) boolChoice = proc dir -> do str <- readString_ -< dir case str of @@ -250,8 +252,8 @@ nixScriptX impure std script scripts params = proc (scriptDir, a) -> do { _etCommand = "perl" , _etParams = contentParam (s ^ script) : params args , _etWriteToStdOut = std - , _etEnv = [("NIX_PATH", textParam "nixpkgs=" - <> textParam nixPackages )] }) -< (env, a) + , _etEnv = EnvExplicit [("NIX_PATH", textParam "nixpkgs=" + <> textParam nixPackages )] }) -< (env, a) where props = def { ep_impure = impure } absScripts sd = map (sd ^) (script : scripts) @@ -281,7 +283,7 @@ mergeDirs' = proc inDirs -> do rmOut :: ArrowFlow eff ex arr => arr (Content Dir) (Content Dir) rmOut = proc dir -> do mergeFiles <<< globDir -< (dir, "*.pickle") -splitDir :: ArrowFlow eff ex arr => arr (Content Dir) ([Content File]) +splitDir :: (ArrowFlow eff ex arr, ArrowChoice arr) => arr (Content Dir) ([Content File]) splitDir = proc dir -> do (_, fs) <- listDirContents -< dir mapA reifyFile -< fs