on wai-handler-launch/1.3.0 help sign in
typeable/wai/warp/statuses.hs
18 lines 475 B history raw
1{-# LANGUAGE OverloadedStrings #-}
2import Network.Wai
3import Network.Wai.Handler.Warp
4import Data.ByteString.Lazy.Char8 (pack)
5import qualified Data.ByteString.Char8 as S
7main = run 3000 app
9app req =
10 return $ responseLBS (Status s' s) [("Content-Type", "text/plain")]
11 $ pack $ concat
12 [ "The status code is "
13 , S.unpack s
14 , ". Have a nice day!"
15 ]
16 where
17 s = S.dropWhile (== '/') $ pathInfo req
18 s' = read $ S.unpack s