Haskell Palindrome Tester


I'm not sure what to say really.. Haskell still baffles me. Imagine a world with no variables and few control structures where I/O is considered a 'side effect' and any input or output is barred from becoming a primitive type. Sounds like a chilling version of hell to me, but evidently lots of people enjoy it.

To run you'll need Hugs or something else that understands Haskell. The command runhugs palin should execute, or you can load it up in the Hugs interpreter and play around with it. (Though I'm not sure why you would.)
import System

-- strip all the whitespace out of a String
strip :: String -> String
strip [] = []
strip (' ':xs)	= strip(xs)
strip (x:xs)		= x:strip(xs)

-- our main 'loop'
main = do
	putStr "Enter the potential palindrome you want to test ('quit' to exit)\n: "
	line <- getLine

	if line == "quit"
		then exitWith ExitSuccess
		else putStr ""

	if (strip line) == reverse (strip line) 
		then putStr (line ++ " is a palindrome\n\n") 
		else putStr (line ++ " is NOT a palindrome\n\n")

	main -- silly there are no loops in Haskell
	
	return()
palin.hs