Created
May 25, 2012 11:42
-
-
Save borkdude/2787518 to your computer and use it in GitHub Desktop.
This file contains 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
import Network.CGI | |
import Text.XHtml | |
inputForm = form << [paragraph << ("My name is " +++ textfield "name"), | |
submit "" "Submit"] | |
greet n = paragraph << ("Hello " ++ n ++ "!") | |
page t b = header << thetitle << t +++ body << b | |
cgiMain = do mn <- getInput "name" | |
let x = maybe inputForm greet mn | |
output . renderHtml $ page "Input example" x | |
main = runCGI $ handleErrors cgiMain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment