on master help sign in
adjust comments and sample program for wai
commitfa48b8f05a0f6a277ad85444f49e4937914d1a99 authorMichael Karg <mgoremeier@gmail.com> dateSun 11 Mar 2018, 21:49 (9 years ago) parente7232dc
2 files changed+7−7
wai/Network/Wai.hs+5−5 wai/webkit-sample/webkit-sample.hs+2−2
wai/Network/Wai.hs+5−5
@@ -4,8 +4,8 @@ This module defines a generic web application interface. It is a common
44protocol between web servers and web applications.
55
66The overriding design principles here are performance and generality. To
7−address performance, this library is built on top of the conduit and
8−blaze-builder packages. The advantages of conduits over lazy IO have been
7+address performance, this library is built on top of the conduit package and
8+bytestring's Builder type. The advantages of conduits over lazy IO have been
99debated elsewhere and so will not be addressed here. However, helper functions
1010like 'responseLBS' allow you to continue using lazy IO if you so desire.
1111
@@ -119,13 +119,13 @@ responseFile = ResponseFile
119119--
120120-- A2. No. If the ByteStrings are small, then they will be copied into a larger
121121-- buffer, which should be a performance gain overall (less system calls). If
122−-- they are already large, then blaze-builder uses an InsertByteString
123−-- instruction to avoid copying.
122+-- they are already large, then an insert operation is used
123+-- to avoid copying.
124124--
125125-- Q3. Doesn't this prevent us from creating comet-style servers, since data
126126-- will be cached?
127127--
128−-- A3. You can force blaze-builder to output a ByteString before it is an
128+-- A3. You can force a Builder to output a ByteString before it is an
129129-- optimal size by sending a flush command.
130130responseBuilder :: H.Status -> H.ResponseHeaders -> Builder -> Response
131131responseBuilder = ResponseBuilder
wai/webkit-sample/webkit-sample.hs+2−2
@@ -5,7 +5,7 @@ import Network.Wai.Handler.Webkit
55import Data.ByteString (ByteString)
66import qualified Data.ByteString.Lazy as L
77import Data.Enumerator (consume, Iteratee)
8−import Blaze.ByteString.Builder (fromLazyByteString)
8+import Data.ByteString.Builder (lazyByteString)
99
1010main :: IO ()
1111main = putStrLn "http://localhost:3000/" >> run "Webkit Sample" app
@@ -27,4 +27,4 @@ postResponse :: L.ByteString -> Iteratee ByteString IO Response
2727postResponse lbs = return $ ResponseBuilder
2828 status200
2929 [("Content-Type", "text/plain")]
30− (fromLazyByteString lbs)
30+ (lazyByteString lbs)