@@ -1,7 +1,7 @@
1+{-# LANGUAGE Rank2Types #-}
1import Network.Wai
2import Network.Wai
2import Network.Wai.Handler.SimpleServer
3import Network.Wai.Handler.SimpleServer
3import qualified Data.ByteString.Char8 as B8
4import qualified Data.ByteString.Char8 as B8
4−import qualified Data.ByteString as B
6main :: IO ()
6main :: IO ()
7main = putStrLn "http://localhost:3000/" >> run 3000 app
7main = putStrLn "http://localhost:3000/" >> run 3000 app
@@ -18,23 +18,12 @@ indexResponse = return Response
18 , body = index
18 , body = index
21−postResponse :: IO (Maybe B.ByteString) -> IO Response
21+postResponse :: (forall a. Enumerator a) -> IO Response
22postResponse rb = return Response
22postResponse rb = return Response
23 { status = Status200
23 { status = Status200
24 , headers = [(ContentType, B8.pack "text/plain")]
24 , headers = [(ContentType, B8.pack "text/plain")]
25− , body = Right $ postBody rb
25+ , body = Right rb
28index :: Either FilePath a
28index :: Either FilePath a
29index = Left "index.html"
29index = Left "index.html"
31−postBody :: IO (Maybe B.ByteString) -> Enumerator a
40− Right a' -> postBody req f a'