snoyberg / http-enumerator

HTTP client package with enumerator interface and HTTPS support.
27 stars 9 forks source link

bytestring-0.9.1.7 in ghc 6.12.3 does not have hGetSome, so patch in bits from bytestring-0.9.1.10 #27

Closed markwright closed 13 years ago

markwright commented 13 years ago

bytestring-0.9.1.7 in ghc 6.12.3 does not have hGetSome, so http-enumerator-0.6.5.5 build fails fixes this compiler error with ghc 6.12.3: Network/HTTP/Enumerator.hs:191:13: Not in scope: `S.hGetSome' Patched version compiles with ghc 6.12.3 and 7.0.4

snoyberg commented 13 years ago

Wouldn't it make more sense to conditionalize based on the version of bytestring, not base?

markwright commented 13 years ago

yes, but how do I do that?

snoyberg commented 13 years ago

I think you can simply replace !MIN_VERSION_base(...) with !MIN_VERSION_bytestring(0, 9, 1, 8).

markwright commented 13 years ago

Thanks, will try it, and rebase the commit to have the change in one commit, so please don't pull yet

snoyberg commented 13 years ago

Cool, thanks. I'm shutting down for the next 24 hours, so don't be surprised when I suddenly stop responding.

markwright commented 13 years ago

Hmm, no changes to the commit as unfortunately your good idea of replace !MIN_VERSION_base(...) with !MIN_VERSION_bytestring(0,9,1,8) fails to compile, and I can't see how to specify the version constraint with only 3 args:

Network/HTTP/Enumerator.hs:121:0: error: macro "MIN_VERSION_bytestring" passed 4 arguments, but takes just 3

Network/HTTP/Enumerator.hs:121:0: error: missing '(' in expression

Network/HTTP/Enumerator.hs:225:0: error: macro "MIN_VERSION_bytestring" passed 4 arguments, but takes just 3

Network/HTTP/Enumerator.hs:225:0: error: missing '(' in expression

snoyberg commented 13 years ago

One last question: what happens if you just set a minimum bound in the cabal file for 0.9.1.8? Does GHC 6.12 not handle newer bytestrings?

markwright commented 13 years ago

I am not using cabal-install, I'm creating gentoo ebuilds. As bytestring is a ghc core library, I can only use the version that is supplied with ghc, which for ghc 6.12.3 is bytestring 0.9.1.7. Creating a bytestring ebuild to install a more recent bytestring would break every haskell package on the system that uses bytestring (note the ebuilds install the packages in the system database, not the user database that is used by cabal-install). I have applied the patch in the gentoo haskell overlay: https://github.com/gentoo-haskell/gentoo-haskell/blob/master/dev-haskell/http-enumerator/files/http-enumerator-0.6.5.5-ghc-6.12.3.patch

cpettitt commented 13 years ago

I'm hitting this problem with GHC 6.12.3 as well. Pulling from the head of Mark's branch fixed it for me.

snoyberg commented 13 years ago

The reason I've been hesitant to pull this is I'm not certain it will work properly on all systems, particularly if someone manually updated bytestring. I'm going to pull for now, and wait to see if things break.