Partly because of XMonad, partly because I've been looking into functional languages for a while, I'm now learning Haskell. Looking for some introductory material I've found the following docs useful:

The online beta version of the tutorial-like Real World Haskell here

The one I like the most, Yet Another Haskell Tutorial originally by Hal Daume III, available at Wikipedia

And A gentle introduction to Haskell, Version 98 that appears to be a kind of official tutorial, though somewhat difficult to grasp at first.

And just for kicks, here's a solution to the last exercise of the chapter "Language basics" of YAHT. The only difference between this and the one in the book is that here getNums is tail-recursive. Not that it really matters...

module Main where import IO main = do hSetBuffering stdin LineBuffering nums <- getNums [] putStrLn ( "The sum is " ++ (show (sum nums))) putStrLn ( "The product is " ++ (show (product nums))) printFactorials nums getNums xs = do putStr "Give me a number (or 0 to stop): " num <- getLine if num == "0" then return xs else getNums ( (read num :: Integer ) : xs) printFactorials [] = return () printFactorials (x : xs) = do putStrLn ((show x) ++ " factorial is " ++ (show (factorial x))) printFactorials xs factorial n | n < 0 = 0 | n > 1 = n * factorial (n - 1) | otherwise = 1

Note that this is a basic solution; it's possible to solve the problem in different, more elegant ways - see the comments at Reddit.