Skip to content

Instantly share code, notes, and snippets.

@borkdude
Created May 25, 2012 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borkdude/2787518 to your computer and use it in GitHub Desktop.
Save borkdude/2787518 to your computer and use it in GitHub Desktop.
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