on master help sign in
Hoogle patch for WAI 3.0
commitb98f8f1f156511bbe66c40f9cb98278ff3298e3d authorMichael Snoyman <michael@snoyman.com> dateMon 9 Jun 2014, 15:27 (12 years ago) parent583e11f
2 files changed+58−70
patching/patches/hoogle-4.2.29.patch−70 patching/patches/hoogle-4.2.32.patch+58
patching/patches/hoogle-4.2.29.patchdeleted−70
@@ -1,70 +0,0 @@
1−diff -ru orig/CHANGES.txt new/CHANGES.txt
2−--- orig/CHANGES.txt 2014-04-03 10:49:26.498200538 +0300
3−+++ new/CHANGES.txt 2014-04-03 10:49:26.000000000 +0300
4−@@ -1,5 +1,6 @@
5− Changelog for Hoogle
6−
7−+ #57, support QuickCheck-2.7
8− 4.2.29
9− #55, if reading as UTF8 fails, explicitly try Latin1
10− Add QuickCheck as a dependency
11−diff -ru orig/hoogle.cabal new/hoogle.cabal
12−--- orig/hoogle.cabal 2014-04-03 10:49:26.518200537 +0300
13−+++ new/hoogle.cabal 2014-04-03 10:49:26.000000000 +0300
14−@@ -46,6 +46,7 @@
15− binary,
16− bytestring >= 0.9,
17− conduit >= 0.2,
18−+ resourcet,
19− parsec >= 2.1,
20− deepseq >= 1.1,
21− text >= 0.11,
22−@@ -145,6 +146,7 @@
23− transformers >= 0.2,
24− uniplate >= 1.6,
25− conduit >= 0.2,
26−+ resourcet,
27− parsec >= 2.1,
28− wai >= 1.1,
29− warp >= 1.1,
30−diff -ru orig/src/General/Web.hs new/src/General/Web.hs
31−--- orig/src/General/Web.hs 2014-04-03 10:49:26.510200537 +0300
32−+++ new/src/General/Web.hs 2014-04-03 10:49:26.000000000 +0300
33−@@ -30,7 +30,8 @@
34−
35− import Blaze.ByteString.Builder(toLazyByteString)
36− import Data.Conduit.List(consume)
37−-import Data.Conduit(($$),Flush,runResourceT,Flush(Chunk))
38−+import Data.Conduit(($$),Flush,Flush(Chunk))
39−+import Control.Monad.Trans.Resource (runResourceT)
40−
41− type Args = [(String, String)]
42−
43−diff -ru orig/src/Test/BWT_FM.hs new/src/Test/BWT_FM.hs
44−--- orig/src/Test/BWT_FM.hs 2014-04-03 10:49:26.502200538 +0300
45−+++ new/src/Test/BWT_FM.hs 2014-04-03 10:49:26.000000000 +0300
46−@@ -3,11 +3,10 @@
47− module Test.BWT_FM(bwt_fm) where
48−
49− import Test.General
50−-import Test.QuickCheck
51− import General.BurrowsWheeler
52−
53−
54− bwt_fm = do
55− compress "tomorrow and tomorrow and tomorrow" === (31,"wwwdd nnoooaatttmmmrrrrrrooo ooo")
56− decompress (31,"wwwdd nnoooaatttmmmrrrrrrooo ooo") === "tomorrow and tomorrow and tomorrow"
57−- quickCheck $ \x -> decompress (compress x) == x
58−+ randCheck $ \x -> decompress (compress x) == x
59−diff -ru orig/src/Test/General.hs new/src/Test/General.hs
60−--- orig/src/Test/General.hs 2014-04-03 10:49:26.502200538 +0300
61−+++ new/src/Test/General.hs 2014-04-03 10:49:26.000000000 +0300
62−@@ -3,7 +3,7 @@
63−
64− import Control.Monad
65− import qualified Data.ByteString as BS
66−-import Test.QuickCheck
67−+import Test.QuickCheck(Arbitrary(..), quickCheckWithResult, stdArgs, Testable, Result(..))
68−
69−
70− instance Arbitrary BS.ByteString where
patching/patches/hoogle-4.2.32.patchnew file+58
@@ -0,0 +1,58 @@
1+diff -ru orig/src/General/Web.hs new/src/General/Web.hs
2+--- orig/src/General/Web.hs 2014-06-09 15:25:38.583521732 +0300
3++++ new/src/General/Web.hs 2014-06-09 15:25:38.000000000 +0300
4+@@ -21,6 +21,9 @@
5+ import General.Base
6+ import System.FilePath
7+ import Network.Wai
8++#if MIN_VERSION_wai(3, 0, 0)
9++import Data.IORef
10++#endif
11+ #if MIN_VERSION_wai(2, 0, 0)
12+ import Network.Wai.Internal
13+ #endif
14+@@ -46,7 +49,15 @@
15+
16+ responseFlatten :: Response -> IO (Status, ResponseHeaders, LBString)
17+ responseFlatten r = do
18+-#if MIN_VERSION_wai(2, 0, 0)
19++#if MIN_VERSION_wai(3, 0, 0)
20++ let (s,hs,withBody) = responseToStream r
21++ ref <- newIORef mempty
22++ let addChunk builder = modifyIORef ref (<> builder)
23++ withBody $ \body -> body addChunk (return ())
24++ builder <- readIORef ref
25++ let res = toLazyByteString builder
26++ return (s,hs,res)
27++#elif MIN_VERSION_wai(2, 0, 0)
28+ let (s,hs,withSrc) = responseToSource r
29+ chunks <- withSrc $ \src -> src $$ consume
30+ let res = toLazyByteString $ mconcat [x | Chunk x <- chunks]
31+diff -ru orig/src/Web/Server.hs new/src/Web/Server.hs
32+--- orig/src/Web/Server.hs 2014-06-09 15:25:38.575521732 +0300
33++++ new/src/Web/Server.hs 2014-06-09 15:25:38.000000000 +0300
34+@@ -32,14 +32,23 @@
35+ resp <- respArgs q
36+ v <- newMVar ()
37+ putStrLn $ "Starting Hoogle Server on port " ++ show port
38+- runSettings defaultSettings{settingsOnException=exception, settingsPort=port} $ \r -> liftIO $ do
39++ runSettings defaultSettings{settingsOnException=exception, settingsPort=port}
40++#if MIN_VERSION_wai(3, 0, 0)
41++ $ \r sendResponse -> do
42++#else
43++ $ \r -> liftIO $ do
44++#endif
45+ start <- getCurrentTime
46+ res <- talk resp q r
47+ responseEvaluate res
48+ stop <- getCurrentTime
49+ let t = floor $ diffUTCTime stop start * 1000
50+ withMVar v $ const $ putStrLn $ bsUnpack (rawPathInfo r) ++ bsUnpack (rawQueryString r) ++ " ms:" ++ show t
51++#if MIN_VERSION_wai(3, 0, 0)
52++ sendResponse res
53++#else
54+ return res
55++#endif
56+
57+
58+ #if MIN_VERSION_wai(2, 0, 0)