on master help sign in
q for quit
7e14cfbMichael Snoyman
.gitignorenew file+2
@@ -0,0 +1,2 @@
1+*.swp
2+/dist/
wai-handler-devel.cabal+1−1
@@ -1,5 +1,5 @@
1Name: wai-handler-devel
1Name: wai-handler-devel
2−Version: 0.0.0
2+Version: 0.0.1
3Synopsis: WAI server that automatically reloads code after modification.
3Synopsis: WAI server that automatically reloads code after modification.
4Description: This handler automatically reloads your source code upon any changes. It works by using the hint package, essentially embedding GHC inside the handler. The handler (both the executable and library) takes three arguments: the port to listen on, the module name containing the application function, and the name of the function.
4Description: This handler automatically reloads your source code upon any changes. It works by using the hint package, essentially embedding GHC inside the handler. The handler (both the executable and library) takes three arguments: the port to listen on, the module name containing the application function, and the name of the function.
5 .
5 .
wai-handler-devel.hs+9−1
@@ -1,6 +1,7 @@
1{-# LANGUAGE DeriveDataTypeable #-}
1{-# LANGUAGE DeriveDataTypeable #-}
2import Network.Wai.Handler.DevelServer (run)
2import Network.Wai.Handler.DevelServer (run)
3import System.Console.CmdArgs
3import System.Console.CmdArgs
4+import Control.Concurrent (forkIO)
4
5
5data Devel = Devel
6data Devel = Devel
6 { port :: Int
7 { port :: Int
@@ -16,4 +17,11 @@ main = do
16 , moduleName = "" &= argPos 1 &= typ "MODULE"
17 , moduleName = "" &= argPos 1 &= typ "MODULE"
17 , function = "" &= argPos 2 &= typ "FUNCTION"
18 , function = "" &= argPos 2 &= typ "FUNCTION"
18 } &= summary "WAI development web server"
19 } &= summary "WAI development web server"
19− run p m f
20+ forkIO $ run p m f
21+ go
22+ where
23+ go = do
24+ x <- getLine
25+ case x of
26+ 'q':_ -> putStrLn "Quitting, goodbye!"
27+ _ -> go