Well, I asked Dani and she said I could create a Haskell catagory in code snippits just by submitting a Haskell program :p . What self respecting code repository would be without one? So here goes, this program calculates the nth triangular number, given n by the user.
result x = foldr (+) 0 [1..read x]
main = do
putStrLn("Your input: ")
user_data <- getLine
putStrLn("My output: ")
It's not good form to put the body of a 'do' block (or any other artifact) on the first row. It's probably illegal, and although GHC accepts the syntax, it won't let you put any more top-level definitions in the file.