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()