Skip to content
Snippets Groups Projects
Commit d61c91fa authored by Oscar Leijendekker's avatar Oscar Leijendekker
Browse files

Updated to chapter 3

parent e8b86af9
No related branches found
No related tags found
No related merge requests found
Pipeline #89464611 passed
......@@ -22,6 +22,8 @@ description: Please see the README on GitHub at <https://github.com/gith
dependencies:
- base >= 4.7 && < 5
- warp >= 3.2.28 && < 4
- wai >= 3.2.2.1 && < 4
- http-types >= 0.12.3 && < 0.13
library:
source-dirs: src
......
{-# LANGUAGE OverloadedStrings #-}
module Lib
( someFunc
) where
import Network.Wai.Handler.Warp (run)
import Network.Wai (Request, Response, ResponseReceived, responseLBS)
import Network.HTTP.Types.Status (status200)
someFunc :: IO ()
someFunc = do
someValue <- return "Hello, Monad!"
putStrLn someValue
someFunc = run 8080 requestHandler
requestHandler :: Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
requestHandler request respond =
let
response = responseLBS status200 [] "Hello, client!"
in
do
putStrLn "Received an HTTP request!"
respond response
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment