I have a simple WAI application (Warp in this case) that answers all web requests with "Hello." I also want it to display "Said hi" on the server every time the request is processed. How to do IO inside my WAI response handler? Here is my application:
{-# LANGUAGE OverloadedStrings #-} import Network.Wai import Network.HTTP.Types (status200) import Network.Wai.Handler.Warp (run) main :: IO () main = do putStrLn "http://localhost:3000/" run 3000 app app :: Application app _ = return hello hello = responseLBS status200 [("Content-Type", "text/plain")] "Hi"
io haskell
mndrix
source share