on master help sign in
Using debug middleware
commit97e55f34e8ad92fb18f944ecf371184d88c22082 authorMichael Snoyman <michael@snoyman.com> dateSun 6 Feb 2011, 18:35 (16 years ago) parent069651e
4 files changed+15−1
Network/Wai/Handler/DevelServer.hs+2−1 Testapp.hs+9 testapp.hs+3 wai-handler-devel.cabal+1
Network/Wai/Handler/DevelServer.hs+2−1
@@ -22,6 +22,7 @@ import Control.Concurrent (forkIO, threadDelay)
2222import System.Directory (getModificationTime)
2323import qualified Network.Wai.Handler.Warp as Warp
2424import Network.Wai.Application.Devel
25+import Network.Wai.Middleware.Debug (debug)
2526
2627import Data.List (nub, group, sort)
2728import System.Time (ClockTime)
@@ -124,7 +125,7 @@ reload modu func extras prevError ah = do
124125 let files = map head $ group $ sort $ concat $ files' : files''
125126 putStrLn "Interpreting success, new app loaded"
126127 E.handle onInitErr $ do
127− swapApp app ah
128+ swapApp (\f -> app $ f . debug) ah
128129 times <- getTimes files
129130 return (Nothing, zip files times)
130131 where
Testapp.hsnew file+9
@@ -0,0 +1,9 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module Testapp where
3+
4+import Network.Wai
5+import Data.ByteString.Lazy.Char8 ()
6+
7+testapp' _ = return $ responseLBS status200 [("Content-Type", "text/html")] "test"
8+
9+testapp f = f testapp'
testapp.hsnew file+3
@@ -0,0 +1,3 @@
1+import Network.Wai.Handler.DevelServer (runQuit)
2+
3+main = runQuit 3000 "Testapp" "testapp" (const $ return [])
wai-handler-devel.cabal+1
@@ -23,6 +23,7 @@ Source-repository head
2323Library
2424 Build-Depends: base >= 4 && < 5
2525 , wai >= 0.3 && < 0.4
26+ , wai-extra >= 0.3 && < 0.4
2627 , warp >= 0.3 && < 0.4
2728 , directory >= 1.0 && < 1.2
2829 , network >= 2.2 && < 2.4