Thursday, December 27, 2007

Literate Haskell with Pandoc (Markdown)

This is Hello.lhs. It uses Markdown.

First, declare module name:

module Main where

Second, define main function:

main :: IO ()

main is of type IO ().

main = do
    putStrLn "Hello, World!"

That's the entire hello world in Haskell. To compile this,

ghc Hello.lhs

To convert this into HTML,

sed -e 's/^> /    /' Hello.lhs | pandoc

KTHXBYE.

No comments:

Post a Comment