Skip to content

Instantly share code, notes, and snippets.

@tcsavage
Created February 13, 2012 16:58
Show Gist options
  • Save tcsavage/1818282 to your computer and use it in GitHub Desktop.
Save tcsavage/1818282 to your computer and use it in GitHub Desktop.
Simple Haskell script for UNIX-like systems. Commented for education.
#! /usr/bin/runhaskell
module Main where
-- As with many programming languages, the main function is the entry point for execution.
main :: IO ()
main = do -- "do notation" is a way of sequencing functions in haskell to simulate imperitive programming.
inp <- getContents -- Here we bind the resulting thunk from getContents to the name 'inp'.
putStrLn $ reverse inp -- Here we reverse the evaluated value of 'inp' and send it to stdout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment