on wai-websockets/1.2.0.3 help sign in
typeable/wai/warp/bigtable-single.hs
22 lines 725 B history raw
1{-# LANGUAGE OverloadedStrings #-}
2import Network.Wai
3import Blaze.ByteString.Builder (Builder, fromByteString)
4import Blaze.ByteString.Builder.Char8 (fromShow)
5import Data.Monoid (mappend)
6import Network.Wai.Handler.Warp (run)
8bigtable :: Builder
9bigtable =
10 fromByteString "<table>"
11 `mappend` foldr mappend (fromByteString "</table>") (replicate 2 row)
12 where
13 row = fromByteString "<tr>"
14 `mappend` foldr go (fromByteString "</tr>") [1..2]
15 go i rest = fromByteString "<td>"
16 `mappend` fromShow i
17 `mappend` fromByteString "</td>"
18 `mappend` rest
20main = run 3000 app
22app _ = return $ ResponseBuilder status200 [("Content-Type", "text/html")] bigtable