on master help sign in
Merge pull request #39 from sol/master

Update wai/README.lhs

commit6ed7ba040b5185514504fe92859aa57ab26c2889 authorMichael Snoyman <michael@snoyman.com> dateWed 1 Feb 2012, 02:24 (15 years ago) parentd3cc79efc4b92a
2 files changed+8−3
wai/README.lhs+2−1 wai/README.md+6−2
wai/README.lhs+2−1
@@ -99,10 +99,11 @@ works without GHC extensions:
9999
100100 import qualified Data.ByteString.Char8 as B8
101101 import qualified Data.ByteString.Lazy.Char8 as LB8
102+ import Data.CaseInsensitive (mk)
102103
103104 notFound = responseLBS
104105 status404
105− [("Content-Type", B8.pack "text/plain")]
106+ [(mk $ B8.pack "Content-Type", B8.pack "text/plain")]
106107 (LB8.pack "404 - Not Found")
107108
108109
wai/README.md+6−2
@@ -12,9 +12,12 @@ You want a minimal example? Here it is!
1212 import Network.HTTP.Types
1313 import Network.Wai.Handler.Warp (run)
1414 import Data.ByteString.Lazy.Char8 () -- Just for an orphan instance
15+ import Control.Monad.IO.Class (liftIO)
1516
1617 app :: Application
17− app _ = return $ responseLBS
18+ app _ = do
19+ liftIO $ putStrLn "I've done some IO here"
20+ return $ responseLBS
1821 status200
1922 [("Content-Type", "text/plain")]
2023 "Hello, Web!"
@@ -91,10 +94,11 @@ For the sake of efficiency, WAI uses the [bytestring] package. We used GHCs [ov
9194
9295 import qualified Data.ByteString.Char8 as B8
9396 import qualified Data.ByteString.Lazy.Char8 as LB8
97+ import Data.CaseInsensitive (mk)
9498
9599 notFound = responseLBS
96100 status404
97− [("Content-Type", B8.pack "text/plain")]
101+ [(mk $ B8.pack "Content-Type", B8.pack "text/plain")]
98102 (LB8.pack "404 - Not Found")
99103
100104