I'm a haskell program

Your IP is 18.205.60.226

My source follows:

#!/usr/bin/runhaskell
import System.Environment

main = printHeaders >> body

printHeaders = mapM_ putStrLn headers >> putStrLn ""
where
headers = ["Content-type: text/html"]

toHtml [] = []
toHtml ('<':xs) = "&lt;" ++ toHtml xs
toHtml ('>':xs) = "&gt;" ++ toHtml xs
toHtml ('&':xs) = "&amp;" ++ toHtml xs
toHtml ('\n':xs) = "<br />" ++ toHtml xs
toHtml ('\t':xs) = "<div style=\"width: 2em; display: inline-block\"></div>" ++ toHtml xs
toHtml (x:xs) = x:toHtml xs

tag t d = "<" ++ t ++ ">" ++ d ++ "</" ++ t ++ ">"

body = do
ip <- getEnv "REMOTE_ADDR"
name <- getProgName
code <- readFile name
putStrLn
(tag "html"
(tag "body"
(tag "h1" "I'm a haskell program") ++
(tag "em" $ "Your IP is " ++ ip) ++
(tag "p"
("My source follows:" ++
(tag "div"
(tag "code" $ toHtml code)
)
)
)
)
)