Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (23 sloc) 744 Bytes
module Main where
import Happstack.Server hiding (port)
import Homepage
import System.Environment
main :: IO ()
main = do
args <- getArgs
case args of
[port] -> startServer $ read port
_ -> putStrLn "pass me a port number, please"
startServer :: Int -> IO ()
startServer port = do
-- this IO action initializes the homepage's state and returns a
-- monad evaluator function
-- eval :: HomepageMonad a -> IO a
-- we'll pass this into simpleHTTP'. (the HTTP server expects to
-- be given IO and needs a function to produce an IO action given
-- our custom state monad.)
initHomepage >>= go
go eval = simpleHTTP' eval (Conf port Nothing) topLevelHandler
Jump to Line
Something went wrong with that request. Please try again.