Alexey Zakhlestin's Blog

Programming for Mac and Web

"Hello World!" in Haskell


Everyone wants “hello world” application for being convinced, that the thing can work. Here is one written in Haskell and web-related. It’s quite straight-forward:

import Network.FastCGI
import Text.XHtml

  = header
    << thetitle
      << "Hello World!"
  +++ body ! [ bgcolor "white"] << "Hi"

main = runFastCGIorCGI (output (renderHtml htmlPage))

To make it working, you need GHC and fastcgi library (with all it’s dependencies)