@@ -13,12 +13,12 @@ import Network.HTTP.Types
1313import Network.Wai.Handler.Warp (run)
1414
1515app :: Application
16−app _ = do
17− putStrLn "I've done some IO here"
18− return $ responseLBS
19− status200
20− [("Content-Type", "text/plain")]
21− "Hello, Web!"
16+app _ respond = do
17+ putStrLn "I've done some IO here"
18+ respond $ responseLBS
19+ status200
20+ [("Content-Type", "text/plain")]
21+ "Hello, Web!"
2222
2323main :: IO ()
2424main = do
@@ -50,7 +50,7 @@ Now we redefine `responseBody` to refer to that file:
5050
5151~~~ {.haskell}
5252app2 :: Application
53−app2 _ = return index
53+app2 _ respond = respond index
5454
5555index :: Response
5656index = responseFile
@@ -73,10 +73,10 @@ Depending on the path info provided with each `Request` we can serve different `
7373
7474~~~ {.haskell}
7575app3 :: Application
76−app3 request = case rawPathInfo request of
77− "/" -> return index
78− "/raw/" -> return plainIndex
79− _ -> return notFound
76+app3 request respond = respond $ case rawPathInfo request of
77+ "/" -> index
78+ "/raw/" -> plainIndex
79+ _ -> notFound
8080
8181plainIndex :: Response
8282plainIndex = responseFile