Merge remote-tracking branch 'upstream/master' into ghcjs-cross-without-cc

This commit is contained in:
John Ericson
2019-11-25 00:23:07 +00:00
5828 changed files with 170193 additions and 135852 deletions
@@ -15,6 +15,11 @@ with haskellLib;
self: super: {
# Arion's test suite needs a Nixpkgs, which is cumbersome to do from Nixpkgs
# itself. For instance, pkgs.path has dirty sources and puts a huge .git in the
# store. Testing is done upstream.
arion-compose = dontCheck super.arion-compose;
# This used to be a core package provided by GHC, but then the compiler
# dropped it. We define the name here to make sure that old packages which
# depend on this library still evaluate (even though they won't compile
@@ -69,7 +74,7 @@ self: super: {
name = "git-annex-${super.git-annex.version}-src";
url = "git://git-annex.branchable.com/";
rev = "refs/tags/" + super.git-annex.version;
sha256 = "1795sad0jr2da2pn28nbqsvpld6zw8gf9yscywixkbabf7ls66fn";
sha256 = "04l1yrjq7n4nlzkmkg73xp6p7vpw1iq53mrmyb8162wqb7zapg4f";
};
}).override {
dbus = if pkgs.stdenv.isLinux then self.dbus else null;
@@ -145,17 +150,14 @@ self: super: {
then addBuildDepend super.halive pkgs.darwin.apple_sdk.frameworks.AppKit
else super.halive;
barbly = addBuildDepend super.barbly pkgs.darwin.apple_sdk.frameworks.AppKit;
# Hakyll's tests are broken on Darwin (3 failures); and they require util-linux
hakyll = appendPatch
(if pkgs.stdenv.isDarwin
hakyll = if pkgs.stdenv.isDarwin
then dontCheck (overrideCabal super.hakyll (drv: {
testToolDepends = [];
}))
else super.hakyll)
(pkgs.fetchpatch {
url = https://github.com/jaspervdj/hakyll/commit/25a4460b75b3c9f3ce339b3311b084d92994f5f1.patch;
sha256 = "sha256-F59WHt52LOKGsGoaD3LAIZFEMe9s9WHfGxQgSh9Q8uQ=";
});
else super.hakyll;
double-conversion = if !pkgs.stdenv.isDarwin
then super.double-conversion
@@ -273,6 +275,7 @@ self: super: {
dlist = dontCheck super.dlist;
docopt = dontCheck super.docopt; # http://hydra.cryp.to/build/499172/log/raw
dom-selector = dontCheck super.dom-selector; # http://hydra.cryp.to/build/497670/log/raw
dotenv = dontCheck super.dotenv; # Tests fail because of missing test file on version 0.8.0.2 fixed on version 0.8.0.4
dotfs = dontCheck super.dotfs; # http://hydra.cryp.to/build/498599/log/raw
DRBG = dontCheck super.DRBG; # http://hydra.cryp.to/build/498245/nixlog/1/raw
ed25519 = dontCheck super.ed25519;
@@ -286,6 +289,7 @@ self: super: {
ghc-parmake = dontCheck super.ghc-parmake;
ghcid = dontCheck super.ghcid;
git-vogue = dontCheck super.git-vogue;
github-rest = dontCheck super.github-rest; # test suite needs the network
gitlib-cmdline = dontCheck super.gitlib-cmdline;
GLFW-b = dontCheck super.GLFW-b; # https://github.com/bsl/GLFW-b/issues/50
hackport = dontCheck super.hackport;
@@ -319,15 +323,14 @@ self: super: {
influxdb = dontCheck super.influxdb;
itanium-abi = dontCheck super.itanium-abi;
katt = dontCheck super.katt;
language-slice = dontCheck super.language-slice;
language-nix = if (pkgs.stdenv.hostPlatform.isAarch64 || pkgs.stdenv.hostPlatform.isi686) then dontCheck super.language-nix else super.language-nix; # aarch64: https://ghc.haskell.org/trac/ghc/ticket/15275
language-slice = dontCheck super.language-slice;
ldap-client = dontCheck super.ldap-client;
lensref = dontCheck super.lensref;
lucid = dontCheck super.lucid; #https://github.com/chrisdone/lucid/issues/25
lvmrun = disableHardening (dontCheck super.lvmrun) ["format"];
matplotlib = dontCheck super.matplotlib;
memcache = dontCheck super.memcache;
MemoTrie = dontHaddock (dontCheck super.MemoTrie);
metrics = dontCheck super.metrics;
milena = dontCheck super.milena;
modular-arithmetic = dontCheck super.modular-arithmetic; # tests require a very old Glob (0.7.*)
@@ -367,6 +370,8 @@ self: super: {
separated = dontCheck super.separated;
shadowsocks = dontCheck super.shadowsocks;
shake-language-c = dontCheck super.shake-language-c;
snap-core = dontCheck super.snap-core;
sourcemap = dontCheck super.sourcemap;
static-resources = dontCheck super.static-resources;
strive = dontCheck super.strive; # fails its own hlint test with tons of warnings
svndump = dontCheck super.svndump;
@@ -383,8 +388,6 @@ self: super: {
webdriver = dontCheck super.webdriver;
webdriver-angular = dontCheck super.webdriver-angular;
xsd = dontCheck super.xsd;
snap-core = dontCheck super.snap-core;
sourcemap = dontCheck super.sourcemap;
zip-archive = dontCheck super.zip-archive; # https://github.com/jgm/zip-archive/issues/57
# These test suites run for ages, even on a fast machine. This is nuts.
@@ -593,9 +596,23 @@ self: super: {
sets = dontCheck super.sets;
# Install icons, metadata and cli program.
bustle = overrideCabal super.bustle (drv: {
# Do not build hgettext as it is broken
# https://gitlab.freedesktop.org/bustle/bustle/issues/13
bustle = overrideCabal (disableCabalFlag (super.bustle.override { hgettext = null; }) "hgettext") (drv: {
buildDepends = [ pkgs.libpcap ];
buildTools = with pkgs.buildPackages; [ gettext perl help2man ];
patches = [
# fix build
# https://gitlab.freedesktop.org/bustle/bustle/merge_requests/14
(pkgs.fetchpatch {
url = "https://gitlab.freedesktop.org/bustle/bustle/commit/ee4b81cbc232d47ba9940f1987777b17452e71ff.patch";
sha256 = "0v9cvbmrma5jcqcg1narpm1549h0cg8mr6i00qxmq0x6hs04dnwa";
})
(pkgs.fetchpatch {
url = "https://gitlab.freedesktop.org/bustle/bustle/commit/aae6843f51f54679d440fb3813e61355dc8406b9.patch";
sha256 = "1a8hr38hd1gdkqhsy56hyl7njw8ci79iigr81aalkb7hn4ckvh2a";
})
];
postInstall = ''
make install PREFIX=$out
'';
@@ -697,14 +714,6 @@ self: super: {
# We get lots of strange compiler errors during the test suite run.
jsaddle = dontCheck super.jsaddle;
# Tools that use gtk2hs-buildtools now depend on them in a custom-setup stanza
cairo = addBuildTool super.cairo self.buildHaskellPackages.gtk2hs-buildtools;
pango = disableHardening (addBuildTool super.pango self.buildHaskellPackages.gtk2hs-buildtools) ["fortify"];
gtk =
if pkgs.stdenv.isDarwin
then appendConfigureFlag super.gtk "-fhave-quartz-gtk"
else super.gtk;
# https://github.com/Philonous/hs-stun/pull/1
# Remove if a version > 0.1.0.1 ever gets released.
stunclient = overrideCabal super.stunclient (drv: {
@@ -1041,6 +1050,8 @@ self: super: {
generateOptparseApplicativeCompletion "dhall" (
dontCheck super.dhall
);
dhall_1_27_0 = dontCheck super.dhall_1_27_0;
# Missing test files in source distribution, fixed once 1.4.0 is bumped
# https://github.com/dhall-lang/dhall-haskell/pull/997
@@ -1060,12 +1071,13 @@ self: super: {
# https://github.com/haskell-hvr/hgettext/issues/14
hgettext = doJailbreak super.hgettext;
# 2.23.0 supports GHC 8.x and up
haddock = super.haddock_2_22_0;
# haddock-api-2.22.0: Break out of “QuickCheck ==2.11.*, hspec >=2.4.4 && <2.6”
haddock-api = dontHaddock (doJailbreak (super.haddock-api));
haddock-api = dontHaddock (doJailbreak (super.haddock-api_2_22_0));
# The test suite is broken. Break out of "base-compat >=0.9.3 && <0.10, hspec >=2.4.4 && <2.5".
haddock-library = doJailbreak (dontCheck super.haddock-library);
# haddock-library_1_6_0 = doJailbreak (dontCheck super.haddock-library_1_6_0);
# Generate shell completion.
cabal2nix = generateOptparseApplicativeCompletion "cabal2nix" super.cabal2nix;
@@ -1104,8 +1116,23 @@ self: super: {
# https://github.com/snapframework/xmlhtml/pull/37
xmlhtml = doJailbreak super.xmlhtml;
# Generate shell completions
purescript = generateOptparseApplicativeCompletion "purs" super.purescript;
purescript =
let
purescriptWithOverrides = super.purescript.override {
# PureScript requires an older version of happy.
happy = self.happy_1_19_9;
};
# PureScript is built against LTS-13, so we need to jailbreak it to
# accept more recent versions of the libraries it requires.
jailBrokenPurescript = doJailbreak purescriptWithOverrides;
# Haddocks for PureScript can't be built.
# https://github.com/purescript/purescript/pull/3745
dontHaddockPurescript = dontHaddock jailBrokenPurescript;
in
# Generate shell completions
generateOptparseApplicativeCompletion "purs" dontHaddockPurescript;
# https://github.com/kcsongor/generic-lens/pull/65
generic-lens = dontCheck super.generic-lens;
@@ -1132,11 +1159,6 @@ self: super: {
# Jailbreak tasty < 1.2: https://github.com/phadej/tdigest/issues/30
tdigest = doJailbreak super.tdigest; # until tdigest > 0.2.1
uri-bytestring = appendPatch super.uri-bytestring (pkgs.fetchpatch {
url = "https://github.com/Soostone/uri-bytestring/commit/e5c5602a97160a6a6304a24947e33e47c9155460.patch";
sha256 = "1qwy8bj6vywhp0075dza8j90zrzsm3144qz3c703s9c4n6pg3gw4";
});
# Requires pg_ctl command during tests
beam-postgres = overrideCabal super.beam-postgres (drv: {
testToolDepends = (drv.testToolDepends or []) ++ [pkgs.postgresql];
@@ -1197,8 +1219,8 @@ self: super: {
temporary-resourcet = doJailbreak super.temporary-resourcet;
# Requires dhall >= 1.23.0
ats-pkg = super.ats-pkg.override { dhall = self.dhall_1_25_0; };
dhall-to-cabal = super.dhall-to-cabal.override { dhall = self.dhall_1_25_0; };
ats-pkg = super.ats-pkg.override { dhall = self.dhall_1_27_0; };
dhall-to-cabal = super.dhall-to-cabal.override { dhall = self.dhall_1_27_0; };
# Test suite doesn't work with current QuickCheck
# https://github.com/pruvisto/heap/issues/11
@@ -1208,10 +1230,10 @@ self: super: {
constraints-deriving = dontCheck super.constraints-deriving;
# need newer version of ghc-libparser
hlint = super.hlint.override { ghc-lib-parser = self.ghc-lib-parser_8_8_0_20190723; };
hlint = super.hlint.override { ghc-lib-parser = self.ghc-lib-parser_8_8_1; };
# https://github.com/sol/hpack/issues/366
hpack = self.hpack_0_32_0;
hpack = self.hpack_0_33_0;
# QuickCheck >=2.3 && <2.13, hspec >=2.1 && <2.7
graphviz = dontCheck super.graphviz;
@@ -1228,4 +1250,72 @@ self: super: {
'';
});
# The LTS-14.x version of their dependencies are too old.
cabal-plan = super.cabal-plan.override { optparse-applicative = self.optparse-applicative_0_15_1_0; };
hoogle = super.hoogle.override { haskell-src-exts = self.haskell-src-exts_1_22_0; };
# Version bounds for http-client are too strict:
# https://github.com/bitnomial/prometheus/issues/34
prometheus = doJailbreak super.prometheus;
# Tasty-tap tests are out-of-date with TAP format
# https://github.com/MichaelXavier/tasty-tap/issues/2
tasty-tap = appendPatch super.tasty-tap (pkgs.fetchpatch {
url = https://patch-diff.githubusercontent.com/raw/MichaelXavier/tasty-tap/pull/3.diff;
sha256 = "0l8zbc56dy8ilxl3k49aiknmfhgpcg3jhs72lh3dk51d0a09d9sv";
});
# The doctests in universum-1.5.0 are broken. The doctests in versions of universum after
# 1.5.0 should be fixed, so this should be able to be removed.
universum = dontCheck super.universum;
# https://github.com/erikd/hjsmin/issues/32
hjsmin = dontCheck super.hjsmin;
# https://github.com/blamario/grampa/issues/19
rank2classes = dontCheck super.rank2classes;
nix-tools = super.nix-tools.overrideScope (self: super: {
# Needs https://github.com/peti/hackage-db/pull/9
hackage-db = super.hackage-db.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "ElvishJerricco";
repo = "hackage-db";
rev = "84ca9fc75ad45a71880e938e0d93ea4bde05f5bd";
sha256 = "0y3kw1hrxhsqmyx59sxba8npj4ya8dpgjljc21gkgdvdy9628q4c";
};
});
});
# upstream issue: https://github.com/vmchale/atspkg/issues/12
language-ats = dontCheck super.language-ats;
# polysemy-plugin requires polysemy >= 1.2.0.0
polysemy = self.polysemy_1_2_3_0;
polysemy-zoo = self.polysemy-zoo_0_6_0_1;
# https://github.com/Happstack/web-routes-th/pull/3
web-routes-th = doJailbreak super.web-routes-th;
# Remove for hail > 0.2.0.0
hail = overrideCabal super.hail (drv: {
patches = [
(pkgs.fetchpatch {
# Relax dependency constraints,
# upstream PR: https://github.com/james-preston/hail/pull/13
url = "https://patch-diff.githubusercontent.com/raw/james-preston/hail/pull/13.patch";
sha256 = "039p5mqgicbhld2z44cbvsmam3pz0py3ybaifwrjsn1y69ldsmkx";
})
(pkgs.fetchpatch {
# Relax dependency constraints,
# upstream PR: https://github.com/james-preston/hail/pull/15
url = "https://patch-diff.githubusercontent.com/raw/james-preston/hail/pull/15.patch";
sha256 = "03kdvr8hxi6isb8yxp5rgcmz855n19m1yacn3d56a4i58j2mldjw";
})
];
});
# Needs the corresponding version of haskell-src-exts.
haskell-src-exts-simple = super.haskell-src-exts-simple.override { haskell-src-exts = self.haskell-src-exts_1_22_0; };
} // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super
@@ -71,28 +71,14 @@ self: super: {
# Break out of "yaml >=0.10.4.0 && <0.11": https://github.com/commercialhaskell/stack/issues/4485
stack = doJailbreak super.stack;
# Needs a recent version from the "develop" branch of the upstream git
# repository to compile with ghc 8.6.4.
liquid-fixpoint = assert super.liquid-fixpoint.version == "0.7.0.7"; overrideSrc super.liquid-fixpoint {
src = pkgs.fetchFromGitHub {
owner = "ucsd-progsys";
repo = "liquid-fixpoint";
rev = "42c027ab9ae47907c588a2f1f9c05a5e0aa881e9";
sha256 = "17qmzq1vx7h04yd38drr6sh6hys3q2rz62qh3pna9kbxlcnikkqf";
};
version = "0.8.0.2-pre-release";
};
liquidhaskell = assert super.liquidhaskell.version == "0.8.2.4"; overrideSrc super.liquidhaskell {
src = pkgs.fetchFromGitHub {
owner = "ucsd-progsys";
repo = "liquidhaskell";
rev = "46f11e8faef006e70d39572d08419283b1280b88";
sha256 = "10z5r6g5acd43bsak762kwhy33ff262zmhs0wga545nbg29q1fyp";
};
version = "0.8.6.0-pre-release";
};
# Newer versions don't compile.
resolv = self.resolv_0_1_1_2;
# cabal2nix needs the latest version of Cabal, and the one
# hackage-db uses must match, so take the latest
cabal2nix = super.cabal2nix.overrideScope (self: super: {
Cabal = self.Cabal_3_0_0_0;
hackage-db = self.hackage-db_2_1_0;
});
}
@@ -42,9 +42,11 @@ self: super: {
xhtml = null;
# Ignore overly restrictive upper version bounds.
aeson-diff = doJailbreak super.aeson-diff;
async = doJailbreak super.async;
cabal-install = doJailbreak super.cabal-install;
ChasingBottoms = doJailbreak super.ChasingBottoms;
chell = doJailbreak super.chell;
cryptohash-sha256 = doJailbreak super.cryptohash-sha256;
Diff = dontCheck super.Diff;
doctest = doJailbreak super.doctest;
@@ -57,116 +59,66 @@ self: super: {
quickcheck-instances = doJailbreak super.quickcheck-instances;
setlocale = doJailbreak super.setlocale;
split = doJailbreak super.split;
system-fileio = doJailbreak super.system-fileio;
tasty-expected-failure = doJailbreak super.tasty-expected-failure;
tasty-hedgehog = doJailbreak super.tasty-hedgehog;
test-framework = doJailbreak super.test-framework;
th-expand-syns = doJailbreak super.th-expand-syns;
# TODO: remove when upstream accepts https://github.com/snapframework/io-streams-haproxy/pull/17
io-streams-haproxy = doJailbreak super.io-streams-haproxy; # base >=4.5 && <4.13
snap-server = doJailbreak super.snap-server;
# use latest version to fix the build
generics-sop = self.generics-sop_0_5_0_0;
hackage-db = self.hackage-db_2_1_0;
lens = self.lens_4_18_1;
memory = self.memory_0_15_0;
microlens = self.microlens_0_4_11_2;
optparse-applicative = self.optparse-applicative_0_15_1_0;
primitive = dontCheck super.primitive_0_7_0_0; # evaluating the test suite gives an infinite recursion
regex-base = self.regex-base_0_94_0_0;
regex-pcre-builtin = self.regex-pcre-builtin_0_95_1_1_8_43;
regex-posix = self.regex-posix_0_96_0_0;
regex-tdfa = self.regex-tdfa_1_3_0;
shelly = self.shelly_1_9_0;
sop-core = self.sop-core_0_5_0_0;
tls = self.tls_1_5_2;
xmonad-contrib = self.xmonad-contrib_0_16;
# These packages don't work and need patching and/or an update.
primitive = overrideSrc (doJailbreak super.primitive) {
version = "20180530-git";
src = pkgs.fetchFromGitHub {
owner = "haskell";
repo = "primitive";
rev = "97964182881aa0419546e0bb188b2d17e4468324";
sha256 = "1p1pinca33vd10iy7hl20c1fc99vharcgcai6z3ngqbq50k2pd3q";
};
};
vector-th-unbox = appendPatch super.vector-th-unbox (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/vector-th-unbox-0.2.1.6.patch";
sha256 = "0169yf9ms1g5mmkc5l6hpffzm34zdrqdng4df02nbdmfgba45h19";
});
cabal-doctest = super.cabal-doctest_1_0_7;
regex-base = overrideCabal (appendPatch super.regex-base (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/regex-base-0.93.2.patch";
sha256 = "01d1plrdx6hcspwn2h6y9pyi5366qk926vb5cl5qcl6x4m23l6y1";
})) (drv: {
preConfigure = "sed -i -e 's/base >=4 && < 4.13,/base,/' regex-base.cabal";
});
regex-posix = appendPatch super.regex-posix (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/regex-posix-0.95.2.patch";
sha256 = "006yli58jpqp786zm1xlncjsilc38iv3a09r4pv94l587sdzasd2";
});
haskell-src-exts = appendPatch super.haskell-src-exts (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/haskell-src-exts-1.21.0.patch";
sha256 = "0alb28hcsp774c9s73dgrajcb44vgv1xqfg2n5a9y2bpyngqscs3";
});
optparse-applicative = appendPatch (doJailbreak super.optparse-applicative) (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/optparse-applicative-0.14.3.0.patch";
sha256 = "068sjj98jqiq3h8h03mg4w2pa11q8lxkx2i4lmxivq77xyhlwq3y";
});
hackage-security = appendPatch (doJailbreak super.hackage-security) (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/hackage-security-0.5.3.0.patch";
sha256 = "0l8x0pbsn18fj5ak5q0g5rva4xw1s9yc4d86a1pfyaz467b9i5a4";
});
happy = appendPatch super.happy (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/happy-1.19.11.patch";
sha256 = "16m659kxbq0s87ak2y1pqggfy67yfvcwc0zi3hcphf3v8735xhkk";
});
hedgehog = appendPatch super.hedgehog (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/hedgehog-0.6.1.patch";
sha256 = "04xwznd3lfgracfz68ls6vfm19rhq8fb74r6ii0grpv6cx4rr21i";
});
easytest = self.easytest_0_3;
regex-tdfa = appendPatch super.regex-tdfa (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/regex-tdfa-1.2.3.1.patch";
sha256 = "1lhas4s2ms666prb475gaw2bqw1v4y8cxi66sy20j727sx7ppjs7";
});
attoparsec = appendPatch (doJailbreak super.attoparsec) (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/attoparsec-0.13.2.2.patch";
sha256 = "13i1p5g0xzxnv966nlyb77mfmxvg9jzbym1d36h1ajn045yf4igl";
});
cassava = appendPatch super.cassava (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/cassava-0.5.1.0.patch";
sha256 = "11scwwjp94si90vb8v5yr291g9qwv5l223z8y0g0lc63932bp63g";
});
shakespeare = appendPatch super.shakespeare (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/shakespeare-2.0.20.patch";
sha256 = "1dgx41ylahj4wk8r422aik0d7qdpawdga4gqz905nvlnhqjla58y";
});
socks = appendPatch super.socks (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/socks-0.6.0.patch";
sha256 = "1dsqmx0sw62x4glh43c0sbizd2y00v5xybiqadn96v6pmfrap5cp";
});
lens = appendPatch (doJailbreak super.lens) (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/lens-4.17.1.patch";
sha256 = "0w89ipi6dfkx5vlw4a64hh6fd0bm9hg33mwpghliyyxik5jmilv1";
});
polyparse = appendPatch (doJailbreak super.polyparse) (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/polyparse-1.12.1.patch";
sha256 = "01b2gnsq0x4fd9na8zpk6pajym55mbz64hgzawlwxdw0y6681kr5";
});
foundation = dontCheck super.foundation;
memory = overrideCabal (appendPatch super.memory (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/memory-0.14.18.patch";
sha256 = "16ar8921s3bi31y1az9zgyg0iaxxc2wvvwqjnl11a17p03wi6b29";
})) (drv: {
editedCabalFile = null;
preConfigure = ''
cp -v ${pkgs.fetchurl {url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/memory-0.14.18.cabal"; sha256 = "1325wny0irnq51rz0f4xgkvm01p6n4z5jid2jgpkhjac8a2sdgwl";}} memory.cabal
'';
});
chell = overrideCabal (doJailbreak super.chell) (_drv: {
broken = false;
});
th-expand-syns = doJailbreak super.th-expand-syns;
shelly = overrideCabal (appendPatch (doJailbreak super.shelly) (pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/shelly-1.8.1.patch";
sha256 = "1kglbwrr4ra81v9x3bfsk5l6pyl0my2a1zkr3qjjx7acn0dfpgbc";
})) (drv: {
editedCabalFile = null;
preConfigure = ''
cp -v ${pkgs.fetchurl {url = "https://raw.githubusercontent.com/hvr/head.hackage/master/patches/shelly-1.8.1.cabal"; sha256 = "0crf0m077wky76f5nav2p9q4fa5q4yhv5l4bq9hd073dzdaywhz0";}} shelly.cabal
sed -i -e 's/< 1.9,/< 2,/' shelly.cabal # bump time version
'';
});
system-fileio = doJailbreak super.system-fileio;
yaml = self.yaml_0_11_1_2;
haskell-src-meta = appendPatch (dontCheck (doJailbreak super.haskell-src-meta)) (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/raw/master/patches/haskell-src-meta-0.8.2.patch";
sha256 = "146im1amywyl29kcldvgrxpwj22lrpzxysl7vc8rmn3hrq130dyc";
url = "https://gitlab.haskell.org/ghc/head.hackage/raw/master/patches/haskell-src-meta-0.8.3.patch";
sha256 = "1asl932mibr5y057xx8v1a7n3qy87lcnclsfh8pbxq1m3iwjkxy8";
});
asn1-encoding = appendPatch (dontCheck (doJailbreak super.asn1-encoding)) (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/raw/master/patches/asn1-encoding-0.9.5.patch";
sha256 = "0a3159rnaw6shjzdm46799crd4pxh33s23qy51xa7z6nv5q8wsb5";
});
tls = self.tls_1_5_1;
vault = dontHaddock super.vault;
monad-par = dontCheck super.monad-par; # test suite does not compile in monad-par-0.3.4.8
# https://github.com/snapframework/snap-core/issues/288
snap-core = overrideCabal super.snap-core (drv: { prePatch = "substituteInPlace src/Snap/Internal/Core.hs --replace 'fail = Fail.fail' ''"; });
# needs a release
json = overrideCabal super.json (drv: { prePatch = "substituteInPlace json.cabal --replace '4.13' '4.14'"; patches = [(
pkgs.fetchpatch {
url = "https://github.com/GaloisInc/json/commit/9d36ca5d865be7e4b2126b68a444b901941d2492.patch";
sha256 = "0vyi5nbivkqg6zngq7rb3wwcj9043m4hmyk155nrcddl8j2smfzv";
}
)]; });
# Upstream ships a broken Setup.hs file.
csv = overrideCabal super.csv (drv: { prePatch = "rm Setup.hs"; });
# mark broken packages
bencode = markBrokenVersion "0.6.0.0" super.bencode;
easytest = markBroken super.easytest;
easytest_0_3 = markBroken super.easytest_0_3;
haskell-src = markBrokenVersion "1.0.3.0" super.haskell-src;
}
@@ -43,13 +43,12 @@ self: super:
# integer-simple is wrong.
#integer-simple = null;
# These packages are core libraries in GHC 7.10.x, but not here.
# These packages are core libraries in GHC 8.6..x, but not here.
bin-package-db = null;
haskeline = self.haskeline_0_7_3_1;
hoopl = self.hoopl_3_10_2_1;
hpc = self.hpc_0_6_0_2;
terminfo = self.terminfo_0_4_1_1;
xhtml = self.xhtml_3000_2_1;
haskeline = self.haskeline_0_7_5_0;
hpc = self.hpc_0_6_0_3;
terminfo = self.terminfo_0_4_1_4;
xhtml = self.xhtml_3000_2_2_1;
## OTHER PACKAGES
@@ -115,7 +114,6 @@ self: super:
];
license = pkgs.stdenv.lib.licenses.mit;
description = "bindings for https://github.com/Matt-Esch/virtual-dom";
inherit (src) homepage;
}) {};
ghcjs-dom = overrideCabal super.ghcjs-dom (drv: {
File diff suppressed because it is too large Load Diff
@@ -53,7 +53,7 @@ self: super: builtins.intersectAttrs super {
# Use the default version of mysql to build this package (which is actually mariadb).
# test phase requires networking
mysql = dontCheck (super.mysql.override { mysql = pkgs.mysql.connector-c; });
mysql = dontCheck (super.mysql.override { mysql = pkgs.libmysqlclient; });
# CUDA needs help finding the SDK headers and libraries.
cuda = overrideCabal super.cuda (drv: {
@@ -94,14 +94,25 @@ self: super: builtins.intersectAttrs super {
# Won't find it's header files without help.
sfml-audio = appendConfigureFlag super.sfml-audio "--extra-include-dirs=${pkgs.openal}/include/AL";
cachix = overrideCabal (addBuildTools (enableSeparateBinOutput super.cachix) [pkgs.boost]) (drv: {
postPatch = (drv.postPatch or "") + ''
substituteInPlace cachix.cabal --replace "c++14" "c++17"
'';
});
# profiling is disabled to allow C++/C mess to work, which is fixed in GHC 8.8
cachix = disableLibraryProfiling super.cachix;
# avoid compiling twice by providing executable as a separate output (with small closure size)
niv = enableSeparateBinOutput super.niv;
ormolu = enableSeparateBinOutput super.ormolu;
ghcid = enableSeparateBinOutput super.ghcid;
# Ensure the necessary frameworks for Darwin.
OpenAL = if pkgs.stdenv.isDarwin
then addExtraLibrary super.OpenAL pkgs.darwin.apple_sdk.frameworks.OpenAL
else super.OpenAL;
# Ensure the necessary frameworks for Darwin.
proteaaudio = if pkgs.stdenv.isDarwin
then addExtraLibrary super.proteaaudio pkgs.darwin.apple_sdk.frameworks.AudioToolbox
else super.proteaaudio;
hzk = overrideCabal super.hzk (drv: {
preConfigure = "sed -i -e /include-dirs/d hzk.cabal";
configureFlags = "--extra-include-dirs=${pkgs.zookeeper_mt}/include/zookeeper";
@@ -158,7 +169,11 @@ self: super: builtins.intersectAttrs super {
gio = disableHardening (addPkgconfigDepend (addBuildTool super.gio self.buildHaskellPackages.gtk2hs-buildtools) pkgs.glib) ["fortify"];
glib = disableHardening (addPkgconfigDepend (addBuildTool super.glib self.buildHaskellPackages.gtk2hs-buildtools) pkgs.glib) ["fortify"];
gtk3 = disableHardening (super.gtk3.override { inherit (pkgs) gtk3; }) ["fortify"];
gtk = disableHardening (addPkgconfigDepend (addBuildTool super.gtk self.buildHaskellPackages.gtk2hs-buildtools) pkgs.gtk2) ["fortify"];
gtk = let gtk1 = addBuildTool super.gtk self.buildHaskellPackages.gtk2hs-buildtools;
gtk2 = addPkgconfigDepend gtk1 pkgs.gtk2;
gtk3 = disableHardening gtk1 ["fortify"];
gtk4 = if pkgs.stdenv.isDarwin then appendConfigureFlag gtk3 "-fhave-quartz-gtk" else gtk4;
in gtk3;
gtksourceview2 = addPkgconfigDepend super.gtksourceview2 pkgs.gtk2;
gtk-traymanager = addPkgconfigDepend super.gtk-traymanager pkgs.gtk3;
@@ -282,10 +297,22 @@ self: super: builtins.intersectAttrs super {
);
llvm-hs =
let dontCheckDarwin = if pkgs.stdenv.isDarwin
then dontCheck
else pkgs.lib.id;
in dontCheckDarwin (super.llvm-hs.override { llvm-config = pkgs.llvm_8; });
let llvmHsWithLlvm8 = super.llvm-hs.override { llvm-config = pkgs.llvm_8; };
in
if pkgs.stdenv.isDarwin
then
overrideCabal llvmHsWithLlvm8 (oldAttrs: {
# One test fails on darwin.
doCheck = false;
# llvm-hs's Setup.hs file tries to add the lib/ directory from LLVM8 to
# the DYLD_LIBRARY_PATH environment variable. This messes up clang
# when called from GHC, probably because clang is version 7, but we are
# using LLVM8.
preCompileBuildDriver = oldAttrs.preCompileBuildDriver or "" + ''
substituteInPlace Setup.hs --replace "addToLdLibraryPath libDir" "pure ()"
'';
})
else llvmHsWithLlvm8;
# Needs help finding LLVM.
spaceprobe = addBuildTool super.spaceprobe self.llvmPackages.llvm;
@@ -429,6 +456,14 @@ self: super: builtins.intersectAttrs super {
[ pkgs.darwin.apple_sdk.frameworks.OpenCL ];
});
# depends on 'hie' executable
lsp-test = dontCheck super.lsp-test;
# tests depend on executable
ghcide = overrideCabal super.ghcide (drv: {
preCheck = ''export PATH="$PWD/dist/build/ghcide:$PATH"'';
});
# GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for
# it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config
# depend on freeglut, which provides GHC to necessary information to generate a correct RPATH.
@@ -477,8 +512,8 @@ self: super: builtins.intersectAttrs super {
# requires autotools to build
secp256k1 = addBuildTools super.secp256k1 [ pkgs.buildPackages.autoconf pkgs.buildPackages.automake pkgs.buildPackages.libtool ];
# tests require git
hapistrano = addBuildTool super.hapistrano pkgs.buildPackages.git;
# tests require git and zsh
hapistrano = addBuildTools super.hapistrano [ pkgs.buildPackages.git pkgs.buildPackages.zsh ];
# This propagates this to everything depending on haskell-gi-base
haskell-gi-base = addBuildDepend super.haskell-gi-base pkgs.gobject-introspection;
@@ -494,9 +529,9 @@ self: super: builtins.intersectAttrs super {
# https://github.com/plow-technologies/servant-streaming/issues/12
servant-streaming-server = dontCheck super.servant-streaming-server;
# https://github.com/haskell-servant/servant/pull/1128
servant-client-core = if (pkgs.lib.getVersion super.servant-client-core) == "0.15" then
appendPatch super.servant-client-core ./patches/servant-client-core-streamBody.patch
# https://github.com/haskell-servant/servant/pull/1238
servant-client-core = if (pkgs.lib.getVersion super.servant-client-core) == "0.16" then
appendPatch super.servant-client-core ./patches/servant-client-core-redact-auth-header.patch
else
super.servant-client-core;
@@ -589,8 +624,16 @@ self: super: builtins.intersectAttrs super {
snap-server = dontCheck super.snap-server;
# Tests require internet
dhall_1_25_0 = dontCheck super.dhall_1_25_0;
http-download = dontCheck super.http-download;
pantry = dontCheck super.pantry;
# Hadolint wants to build a statically linked binary by default.
hadolint = overrideCabal super.hadolint (drv: {
preConfigure = "sed -i -e /ld-options:/d hadolint.cabal";
});
# gtk2hs-buildtools is listed in setupHaskellDepends, but we
# need it during the build itself, too.
cairo = addBuildTool super.cairo self.buildHaskellPackages.gtk2hs-buildtools;
pango = disableHardening (addBuildTool super.pango self.buildHaskellPackages.gtk2hs-buildtools) ["fortify"];
}
@@ -44,7 +44,7 @@ in
);
tensorflow-proto = super.tensorflow-proto.override {
inherit proto-lens proto-lens-protoc proto-lens-protobuf-types;
inherit proto-lens proto-lens-protobuf-types;
};
tensorflow = super.tensorflow.override {
inherit mainland-pretty proto-lens;
@@ -25,7 +25,7 @@ in
, doBenchmark ? false
, doHoogle ? true
, editedCabalFile ? null
, enableLibraryProfiling ? true
, enableLibraryProfiling ? !(ghc.isGhcjs or false)
, enableExecutableProfiling ? false
, profilingDetail ? "exported-functions"
# TODO enable shared libs for cross-compiling
@@ -20,6 +20,10 @@ let
in stdenv.mkDerivation (args // {
# Doesn't work in the sandbox. Pass `--option sandbox relaxed` or
# `--option sandbox false` to be able to build this
__noChroot = true;
buildInputs = buildInputs
++ lib.optional (stdenv.hostPlatform.libc == "glibc") glibcLocales;
File diff suppressed because it is too large Load Diff
@@ -122,9 +122,9 @@ let
haskellSrc2nix = { name, src, sha256 ? null, extraCabal2nixOptions ? "" }:
let
sha256Arg = if sha256 == null then "--sha256=" else ''--sha256="${sha256}"'';
in pkgs.buildPackages.stdenv.mkDerivation {
in buildPackages.stdenv.mkDerivation {
name = "cabal2nix-${name}";
nativeBuildInputs = [ pkgs.buildPackages.cabal2nix ];
nativeBuildInputs = [ buildPackages.cabal2nix ];
preferLocalBuild = true;
allowSubstitutes = false;
phases = ["installPhase"];
@@ -133,11 +133,11 @@ let
installPhase = ''
export HOME="$TMP"
mkdir -p "$out"
cabal2nix --compiler=${self.ghc.haskellCompilerName} --system=${hostPlatform.system} ${sha256Arg} "${src}" ${extraCabal2nixOptions} > "$out/default.nix"
cabal2nix --compiler=${self.ghc.haskellCompilerName} --system=${hostPlatform.config} ${sha256Arg} "${src}" ${extraCabal2nixOptions} > "$out/default.nix"
'';
};
all-cabal-hashes-component = name: version: pkgs.runCommand "all-cabal-hashes-component-${name}-${version}" {} ''
all-cabal-hashes-component = name: version: buildPackages.runCommand "all-cabal-hashes-component-${name}-${version}" {} ''
tar --wildcards -xzvf ${all-cabal-hashes} \*/${name}/${version}/${name}.{json,cabal}
mkdir -p $out
mv */${name}/${version}/${name}.{json,cabal} $out
@@ -181,7 +181,10 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
# '... foo = self.callHackage "foo" "1.5.3" {}; ...'
callHackage = name: version: callPackageKeepDeriver (self.hackage2nix name version);
# callHackageDirect :: Text -> Text -> AttrSet -> HaskellPackage
# callHackageDirect
# :: { pkg :: Text, ver :: Text, sha256 :: Text }
# -> AttrSet
# -> HaskellPackage
#
# This function does not depend on all-cabal-hashes and therefore will work
# for any version that has been released on hackage as opposed to only
@@ -0,0 +1,24 @@
From 657b70d174fe5cb61e56cb8b9c5e57f1ec216f2b Mon Sep 17 00:00:00 2001
From: Mikhail Glushenkov <mikhail.glushenkov@gmail.com>
Date: Wed, 10 Apr 2019 17:42:57 +0100
Subject: [PATCH] Allow http-client 0.6.*.
Changelog doesn't list any silently breaking semantic changes.
---
amazonka/amazonka.cabal | 2 +-
core/amazonka-core.cabal | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/amazonka/amazonka.cabal b/amazonka/amazonka.cabal
index e86713f11c..81c4cb7e48 100644
--- a/amazonka.cabal
+++ b/amazonka.cabal
@@ -67,7 +67,7 @@ library
, conduit-extra >= 1.1
, directory >= 1.2
, exceptions >= 0.6
- , http-client >= 0.4 && < 0.6
+ , http-client >= 0.4 && < 0.7
, http-conduit >= 2.1.7 && < 3
, http-types >= 0.8
, ini >= 0.3.5
@@ -0,0 +1,26 @@
From 657b70d174fe5cb61e56cb8b9c5e57f1ec216f2b Mon Sep 17 00:00:00 2001
From: Mikhail Glushenkov <mikhail.glushenkov@gmail.com>
Date: Wed, 10 Apr 2019 17:42:57 +0100
Subject: [PATCH] Allow http-client 0.6.*.
Changelog doesn't list any silently breaking semantic changes.
---
amazonka/amazonka.cabal | 2 +-
core/amazonka-core.cabal | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/amazonka-core.cabal b/core/amazonka-core.cabal
index 9796e007cf..eccb24e5bd 100644
--- a/amazonka-core.cabal
+++ b/amazonka-core.cabal
@@ -90,7 +90,7 @@ library
, deepseq >= 1.4
, exceptions >= 0.6
, hashable >= 1.2
- , http-client >= 0.4 && < 0.6
+ , http-client >= 0.4 && < 0.7
, http-conduit >= 2.1.4 && < 3
, http-types >= 0.8 && (<0.11 || >=0.12)
, lens >= 4.4
--
2.23.0
@@ -43,13 +43,13 @@ index c87565d..88b3db4 100644
+ghc = fromMaybe GHC_PATHS_GHC nixGhc
+ghc_pkg = fromMaybe GHC_PATHS_GHC_PKG nixGhcPkg
diff --git a/Setup.hs b/Setup.hs
index fad5026..1651650 100644
index f2d1733..ca4792e 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -27,13 +27,13 @@ main = defaultMainWithHooks simpleUserHooks {
defaultPostConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ()
defaultPostConf args flags pkgdescr lbi = do
@@ -39,13 +39,13 @@ main = defaultMainWithHooks simpleUserHooks {
#else
libdir_ <- rawSystemProgramStdoutConf (fromFlag (configVerbosity flags))
#endif
- ghcProgram (withPrograms lbi) ["--print-libdir"]
+ ghcjsProgram (withPrograms lbi) ["--print-libdir"]
let libdir = reverse $ dropWhile isSpace $ reverse libdir_
@@ -0,0 +1,75 @@
diff --git a/servant-client-core.cabal b/servant-client-core.cabal
index 5789da601..3faf65bb4 100644
--- a/servant-client-core.cabal
+++ b/servant-client-core.cabal
@@ -96,6 +96,7 @@ test-suite spec
main-is: Spec.hs
other-modules:
Servant.Client.Core.Internal.BaseUrlSpec
+ Servant.Client.Core.RequestSpec
-- Dependencies inherited from the library. No need to specify bounds.
build-depends:
diff --git a/src/Servant/Client/Core/Request.hs b/src/Servant/Client/Core/Request.hs
index 73756e702..0276d46f8 100644
--- a/src/Servant/Client/Core/Request.hs
+++ b/src/Servant/Client/Core/Request.hs
@@ -64,8 +64,32 @@ data RequestF body path = Request
, requestHeaders :: Seq.Seq Header
, requestHttpVersion :: HttpVersion
, requestMethod :: Method
- } deriving (Generic, Typeable, Eq, Show, Functor, Foldable, Traversable)
+ } deriving (Generic, Typeable, Eq, Functor, Foldable, Traversable)
+instance (Show a, Show b) =>
+ Show (Servant.Client.Core.Request.RequestF a b) where
+ showsPrec p req
+ = showParen
+ (p >= 11)
+ ( showString "Request {requestPath = "
+ . showsPrec 0 (requestPath req)
+ . showString ", requestQueryString = "
+ . showsPrec 0 (requestQueryString req)
+ . showString ", requestBody = "
+ . showsPrec 0 (requestBody req)
+ . showString ", requestAccept = "
+ . showsPrec 0 (requestAccept req)
+ . showString ", requestHeaders = "
+ . showsPrec 0 (redactSensitiveHeader <$> requestHeaders req))
+ . showString ", requestHttpVersion = "
+ . showsPrec 0 (requestHttpVersion req)
+ . showString ", requestMethod = "
+ . showsPrec 0 (requestMethod req)
+ . showString "}"
+ where
+ redactSensitiveHeader :: Header -> Header
+ redactSensitiveHeader ("Authorization", _) = ("Authorization", "<REDACTED>")
+ redactSensitiveHeader h = h
instance Bifunctor RequestF where bimap = bimapDefault
instance Bifoldable RequestF where bifoldMap = bifoldMapDefault
instance Bitraversable RequestF where
diff --git a/test/Servant/Client/Core/RequestSpec.hs b/test/Servant/Client/Core/RequestSpec.hs
new file mode 100644
index 000000000..99a1db7d3
--- /dev/null
+++ b/test/Servant/Client/Core/RequestSpec.hs
@@ -0,0 +1,19 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# LANGUAGE OverloadedStrings #-}
+module Servant.Client.Core.RequestSpec (spec) where
+
+
+import Prelude ()
+import Prelude.Compat
+import Control.Monad
+import Data.List (isInfixOf)
+import Servant.Client.Core.Request
+import Test.Hspec
+
+spec :: Spec
+spec = do
+ describe "Request" $ do
+ describe "show" $ do
+ it "redacts the authorization header" $ do
+ let request = void $ defaultRequest { requestHeaders = pure ("authorization", "secret") }
+ isInfixOf "secret" (show request) `shouldBe` False
@@ -1,82 +0,0 @@
diff --git a/src/Servant/Client/Core/Internal/HasClient.hs b/src/Servant/Client/Core/Internal/HasClient.hs
index 712007006..6be92ec6d 100644
--- a/src/Servant/Client/Core/Internal/HasClient.hs
+++ b/src/Servant/Client/Core/Internal/HasClient.hs
@@ -16,6 +16,8 @@ module Servant.Client.Core.Internal.HasClient where
import Prelude ()
import Prelude.Compat
+import Control.Concurrent.MVar
+ (modifyMVar, newMVar)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
import Data.Foldable
@@ -36,13 +38,14 @@ import qualified Network.HTTP.Types as H
import Servant.API
((:<|>) ((:<|>)), (:>), AuthProtect, BasicAuth, BasicAuthData,
BuildHeadersTo (..), Capture', CaptureAll, Description,
- EmptyAPI, FramingUnrender (..), FromSourceIO (..), Header',
- Headers (..), HttpVersion, IsSecure, MimeRender (mimeRender),
+ EmptyAPI, FramingRender (..), FramingUnrender (..),
+ FromSourceIO (..), Header', Headers (..), HttpVersion,
+ IsSecure, MimeRender (mimeRender),
MimeUnrender (mimeUnrender), NoContent (NoContent), QueryFlag,
QueryParam', QueryParams, Raw, ReflectMethod (..), RemoteHost,
ReqBody', SBoolI, Stream, StreamBody', Summary, ToHttpApiData,
- Vault, Verb, WithNamedContext, contentType, getHeadersHList,
- getResponse, toQueryParam, toUrlPiece)
+ ToSourceIO (..), Vault, Verb, WithNamedContext, contentType,
+ getHeadersHList, getResponse, toQueryParam, toUrlPiece)
import Servant.API.ContentTypes
(contentTypes)
import Servant.API.Modifiers
@@ -538,7 +541,7 @@ instance (MimeRender ct a, HasClient m api)
hoistClientMonad pm (Proxy :: Proxy api) f (cl a)
instance
- ( HasClient m api
+ ( HasClient m api, MimeRender ctype chunk, FramingRender framing, ToSourceIO chunk a
) => HasClient m (StreamBody' mods framing ctype a :> api)
where
@@ -547,7 +550,39 @@ instance
hoistClientMonad pm _ f cl = \a ->
hoistClientMonad pm (Proxy :: Proxy api) f (cl a)
- clientWithRoute _pm Proxy _req _body = error "HasClient @StreamBody"
+ clientWithRoute pm Proxy req body
+ = clientWithRoute pm (Proxy :: Proxy api)
+ $ setRequestBody (RequestBodyStreamChunked givesPopper) (contentType ctypeP) req
+ where
+ ctypeP = Proxy :: Proxy ctype
+ framingP = Proxy :: Proxy framing
+
+ sourceIO = framingRender
+ framingP
+ (mimeRender ctypeP :: chunk -> BL.ByteString)
+ (toSourceIO body)
+
+ -- not pretty.
+ givesPopper :: (IO BS.ByteString -> IO ()) -> IO ()
+ givesPopper needsPopper = S.unSourceT sourceIO $ \step0 -> do
+ ref <- newMVar step0
+
+ -- Note sure we need locking, but it's feels safer.
+ let popper :: IO BS.ByteString
+ popper = modifyMVar ref nextBs
+
+ needsPopper popper
+
+ nextBs S.Stop = return (S.Stop, BS.empty)
+ nextBs (S.Error err) = fail err
+ nextBs (S.Skip s) = nextBs s
+ nextBs (S.Effect ms) = ms >>= nextBs
+ nextBs (S.Yield lbs s) = case BL.toChunks lbs of
+ [] -> nextBs s
+ (x:xs) | BS.null x -> nextBs step'
+ | otherwise -> return (step', x)
+ where
+ step' = S.Yield (BL.fromChunks xs) s