mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-02-15 07:45:49 +01:00
Hoogle patch for WAI 3.0
This commit is contained in:
parent
583e11f517
commit
b98f8f1f15
@ -1,70 +0,0 @@
|
|||||||
diff -ru orig/CHANGES.txt new/CHANGES.txt
|
|
||||||
--- orig/CHANGES.txt 2014-04-03 10:49:26.498200538 +0300
|
|
||||||
+++ new/CHANGES.txt 2014-04-03 10:49:26.000000000 +0300
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
Changelog for Hoogle
|
|
||||||
|
|
||||||
+ #57, support QuickCheck-2.7
|
|
||||||
4.2.29
|
|
||||||
#55, if reading as UTF8 fails, explicitly try Latin1
|
|
||||||
Add QuickCheck as a dependency
|
|
||||||
diff -ru orig/hoogle.cabal new/hoogle.cabal
|
|
||||||
--- orig/hoogle.cabal 2014-04-03 10:49:26.518200537 +0300
|
|
||||||
+++ new/hoogle.cabal 2014-04-03 10:49:26.000000000 +0300
|
|
||||||
@@ -46,6 +46,7 @@
|
|
||||||
binary,
|
|
||||||
bytestring >= 0.9,
|
|
||||||
conduit >= 0.2,
|
|
||||||
+ resourcet,
|
|
||||||
parsec >= 2.1,
|
|
||||||
deepseq >= 1.1,
|
|
||||||
text >= 0.11,
|
|
||||||
@@ -145,6 +146,7 @@
|
|
||||||
transformers >= 0.2,
|
|
||||||
uniplate >= 1.6,
|
|
||||||
conduit >= 0.2,
|
|
||||||
+ resourcet,
|
|
||||||
parsec >= 2.1,
|
|
||||||
wai >= 1.1,
|
|
||||||
warp >= 1.1,
|
|
||||||
diff -ru orig/src/General/Web.hs new/src/General/Web.hs
|
|
||||||
--- orig/src/General/Web.hs 2014-04-03 10:49:26.510200537 +0300
|
|
||||||
+++ new/src/General/Web.hs 2014-04-03 10:49:26.000000000 +0300
|
|
||||||
@@ -30,7 +30,8 @@
|
|
||||||
|
|
||||||
import Blaze.ByteString.Builder(toLazyByteString)
|
|
||||||
import Data.Conduit.List(consume)
|
|
||||||
-import Data.Conduit(($$),Flush,runResourceT,Flush(Chunk))
|
|
||||||
+import Data.Conduit(($$),Flush,Flush(Chunk))
|
|
||||||
+import Control.Monad.Trans.Resource (runResourceT)
|
|
||||||
|
|
||||||
type Args = [(String, String)]
|
|
||||||
|
|
||||||
diff -ru orig/src/Test/BWT_FM.hs new/src/Test/BWT_FM.hs
|
|
||||||
--- orig/src/Test/BWT_FM.hs 2014-04-03 10:49:26.502200538 +0300
|
|
||||||
+++ new/src/Test/BWT_FM.hs 2014-04-03 10:49:26.000000000 +0300
|
|
||||||
@@ -3,11 +3,10 @@
|
|
||||||
module Test.BWT_FM(bwt_fm) where
|
|
||||||
|
|
||||||
import Test.General
|
|
||||||
-import Test.QuickCheck
|
|
||||||
import General.BurrowsWheeler
|
|
||||||
|
|
||||||
|
|
||||||
bwt_fm = do
|
|
||||||
compress "tomorrow and tomorrow and tomorrow" === (31,"wwwdd nnoooaatttmmmrrrrrrooo ooo")
|
|
||||||
decompress (31,"wwwdd nnoooaatttmmmrrrrrrooo ooo") === "tomorrow and tomorrow and tomorrow"
|
|
||||||
- quickCheck $ \x -> decompress (compress x) == x
|
|
||||||
+ randCheck $ \x -> decompress (compress x) == x
|
|
||||||
diff -ru orig/src/Test/General.hs new/src/Test/General.hs
|
|
||||||
--- orig/src/Test/General.hs 2014-04-03 10:49:26.502200538 +0300
|
|
||||||
+++ new/src/Test/General.hs 2014-04-03 10:49:26.000000000 +0300
|
|
||||||
@@ -3,7 +3,7 @@
|
|
||||||
|
|
||||||
import Control.Monad
|
|
||||||
import qualified Data.ByteString as BS
|
|
||||||
-import Test.QuickCheck
|
|
||||||
+import Test.QuickCheck(Arbitrary(..), quickCheckWithResult, stdArgs, Testable, Result(..))
|
|
||||||
|
|
||||||
|
|
||||||
instance Arbitrary BS.ByteString where
|
|
||||||
58
patching/patches/hoogle-4.2.32.patch
Normal file
58
patching/patches/hoogle-4.2.32.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
diff -ru orig/src/General/Web.hs new/src/General/Web.hs
|
||||||
|
--- orig/src/General/Web.hs 2014-06-09 15:25:38.583521732 +0300
|
||||||
|
+++ new/src/General/Web.hs 2014-06-09 15:25:38.000000000 +0300
|
||||||
|
@@ -21,6 +21,9 @@
|
||||||
|
import General.Base
|
||||||
|
import System.FilePath
|
||||||
|
import Network.Wai
|
||||||
|
+#if MIN_VERSION_wai(3, 0, 0)
|
||||||
|
+import Data.IORef
|
||||||
|
+#endif
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
import Network.Wai.Internal
|
||||||
|
#endif
|
||||||
|
@@ -46,7 +49,15 @@
|
||||||
|
|
||||||
|
responseFlatten :: Response -> IO (Status, ResponseHeaders, LBString)
|
||||||
|
responseFlatten r = do
|
||||||
|
-#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
+#if MIN_VERSION_wai(3, 0, 0)
|
||||||
|
+ let (s,hs,withBody) = responseToStream r
|
||||||
|
+ ref <- newIORef mempty
|
||||||
|
+ let addChunk builder = modifyIORef ref (<> builder)
|
||||||
|
+ withBody $ \body -> body addChunk (return ())
|
||||||
|
+ builder <- readIORef ref
|
||||||
|
+ let res = toLazyByteString builder
|
||||||
|
+ return (s,hs,res)
|
||||||
|
+#elif MIN_VERSION_wai(2, 0, 0)
|
||||||
|
let (s,hs,withSrc) = responseToSource r
|
||||||
|
chunks <- withSrc $ \src -> src $$ consume
|
||||||
|
let res = toLazyByteString $ mconcat [x | Chunk x <- chunks]
|
||||||
|
diff -ru orig/src/Web/Server.hs new/src/Web/Server.hs
|
||||||
|
--- orig/src/Web/Server.hs 2014-06-09 15:25:38.575521732 +0300
|
||||||
|
+++ new/src/Web/Server.hs 2014-06-09 15:25:38.000000000 +0300
|
||||||
|
@@ -32,14 +32,23 @@
|
||||||
|
resp <- respArgs q
|
||||||
|
v <- newMVar ()
|
||||||
|
putStrLn $ "Starting Hoogle Server on port " ++ show port
|
||||||
|
- runSettings defaultSettings{settingsOnException=exception, settingsPort=port} $ \r -> liftIO $ do
|
||||||
|
+ runSettings defaultSettings{settingsOnException=exception, settingsPort=port}
|
||||||
|
+#if MIN_VERSION_wai(3, 0, 0)
|
||||||
|
+ $ \r sendResponse -> do
|
||||||
|
+#else
|
||||||
|
+ $ \r -> liftIO $ do
|
||||||
|
+#endif
|
||||||
|
start <- getCurrentTime
|
||||||
|
res <- talk resp q r
|
||||||
|
responseEvaluate res
|
||||||
|
stop <- getCurrentTime
|
||||||
|
let t = floor $ diffUTCTime stop start * 1000
|
||||||
|
withMVar v $ const $ putStrLn $ bsUnpack (rawPathInfo r) ++ bsUnpack (rawQueryString r) ++ " ms:" ++ show t
|
||||||
|
+#if MIN_VERSION_wai(3, 0, 0)
|
||||||
|
+ sendResponse res
|
||||||
|
+#else
|
||||||
|
return res
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
Loading…
Reference in New Issue
Block a user