on e46572e help sign in
stackage/patching/patches/hoogle-4.2.23.patch
72 lines 2.1 kB history raw
1diff -ru orig/src/General/Web.hs new/src/General/Web.hs
2--- orig/src/General/Web.hs 2013-12-04 19:36:25.387122831 +0200
3+++ new/src/General/Web.hs 2013-12-04 19:36:25.000000000 +0200
4@@ -1,3 +1,4 @@
5+{-# LANGUAGE CPP #-}
6 {-# LANGUAGE PatternGuards #-}
7
8 {- |
9@@ -15,6 +16,9 @@
10 import General.System
11 import General.Base
12 import Network.Wai
13+#if MIN_VERSION_wai(2, 0, 0)
14+import Network.Wai.Internal
15+#endif
16 import Network.HTTP.Types
17 import Data.CaseInsensitive(original)
18 import qualified Data.ByteString.Lazy.Char8 as LBS
19@@ -34,10 +38,17 @@
21 responseFlatten :: Response -> IO (Status, ResponseHeaders, LBString)
22 responseFlatten r = do
23+#if MIN_VERSION_wai(2, 0, 0)
24+ let (s,hs,withSrc) = responseToSource r
25+ chunks <- withSrc $ \src -> src $$ consume
26+ let res = toLazyByteString $ mconcat [x | Chunk x <- chunks]
27+ return (s,hs,res)
28+#else
29 let (s,hs,rest) = responseSource r
30 chunks <- runResourceT $ rest $$ consume
31 let res = toLazyByteString $ mconcat [x | Chunk x <- chunks]
32 return (s,hs,res)
33+#endif
36 responseEvaluate :: Response -> IO ()
37diff -ru orig/src/Web/Server.hs new/src/Web/Server.hs
38--- orig/src/Web/Server.hs 2013-12-04 19:36:25.379122832 +0200
39+++ new/src/Web/Server.hs 2013-12-04 19:36:25.000000000 +0200
40@@ -1,4 +1,4 @@
41-{-# LANGUAGE RecordWildCards, ScopedTypeVariables, PatternGuards #-}
42+{-# LANGUAGE RecordWildCards, ScopedTypeVariables, PatternGuards, CPP #-}
44 module Web.Server(server) where
46@@ -16,6 +16,9 @@
47 import Data.Time.Clock
49 import Network.Wai
50+#if MIN_VERSION_wai(2, 0, 0)
51+import Network.Wai.Internal
52+#endif
53 import Network.Wai.Handler.Warp
56@@ -34,9 +37,15 @@
57 return res
60+#if MIN_VERSION_wai(2, 0, 0)
61+exception :: Maybe Request -> SomeException -> IO ()
62+exception _ e | Just (_ :: InvalidRequest) <- fromException e = return ()
63+ | otherwise = putStrLn $ "Error: " ++ show e
64+#else
65 exception :: SomeException -> IO ()
66 exception e | Just (_ :: InvalidRequest) <- fromException e = return ()
67 | otherwise = putStrLn $ "Error: " ++ show e
68+#endif
71 respArgs :: CmdLine -> IO (IO ResponseArgs)
72Only in orig: test