Created
August 5, 2011 20:25
-
-
Save joseph-montanez/1128434 to your computer and use it in GitHub Desktop.
Delayed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghc -XPackageImports pong.hs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import System | |
import Control.Applicative | |
import "monads-fd" Control.Monad.Trans | |
import Snap.Http.Server | |
import Snap.Iteratee | |
import Snap.Types | |
import Snap.Util.FileServe | |
import qualified Control.Concurrent as T | |
site :: Snap () | |
site = do | |
liftIO (T.threadDelay $ 1000000 * 5) | |
writeBS "PONG" | |
main :: IO () | |
main = do | |
args <- getArgs | |
let port = case args of | |
[] -> 3000 | |
p:_ -> read p | |
config = setPort port $ | |
setAccessLog Nothing $ | |
defaultConfig | |
httpServe config site |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment