@@ -1,12 +1,12 @@
11{-# LANGUAGE Rank2Types #-}
2+{-# LANGUAGE OverloadedStrings #-}
23import Network.Wai
3−import Network.Wai.Enumerator (buffer)
4−import Network.Wai.Handler.SimpleServer
4+import Network.Wai.Handler.Webkit
55import qualified Data.ByteString.Char8 as B8
66import qualified Network.Wai.Source as Source
77
88main :: IO ()
9−main = putStrLn "http://localhost:3000/" >> run 3000 app
9+main = putStrLn "http://localhost:3000/" >> run "3000" app
1010
1111app :: Application
1212app req = case B8.unpack $ pathInfo req of
@@ -15,17 +15,16 @@ app req = case B8.unpack $ pathInfo req of
1515
1616indexResponse :: IO Response
1717indexResponse = return Response
18− { status = Status200
19− , responseHeaders = [(ContentType, B8.pack "text/html")]
18+ { status = status200
19+ , responseHeaders = [("Content-Type" , B8.pack "text/html")]
2020 , responseBody = index
2121 }
2222
2323postResponse :: Enumerator -> IO Response
2424postResponse rb = return Response
25− { status = Status200
26− , responseHeaders = [(ContentType, B8.pack "text/plain")]
27− , responseBody = Right $ buffer rb
25+ { status = status200
26+ , responseHeaders = [("Content-Type", B8.pack "text/plain")]
27+ , responseBody = ResponseEnumerator rb
2828 }
2929
30−index :: Either FilePath a
31−index = Left "index.html"
30+index = ResponseFile "index.html"