1{-# LANGUAGE OverloadedStrings #-}
2import qualified Network.HTTP.Enumerator as H
3import qualified Network.Wai as W
4import Network.Wai.Middleware.Gzip (gzip)
5import Network.Wai.Handler.SimpleServer (run)
6import qualified Data.ByteString.Char8 as S8
7import qualified Data.ByteString.Lazy.Char8 ()
8import Data.Enumerator (($$), joinI, run_)
9import Blaze.ByteString.Builder (fromByteString)
10import qualified Data.Enumerator as E
13main = run 3000 $ gzip False app
16app W.Request { W.pathInfo = path } =
17 case H.parseUrl $ "http://wiki.yesodweb.com" ++ S8.unpack path of
18 Nothing -> return notFound
19 Just hreq -> return $ W.ResponseEnumerator $ run_ . H.http hreq . go
21 go f s h = joinI $ E.map fromByteString $$ f s $ filter safe h
22 safe (x, _) = not $ x `elem` ["Content-Encoding", "Transfer-Encoding"]
25notFound = W.ResponseLBS W.status404 [("Content-Type", "text/plain")] "Not found"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list