-- Main function which takes input and prints palindrome or not by using the function palindrome to check main :: IO () main = do print "Enter a number: " inputStr <- getLine let input = read inputStr :: Integer if palindrome input then print $ show input <> " is a palindrome number" else print $ show input <> " is not palindrome number" -- palindrome function which checks whether the number is a palindrome by comparing with the reverse of the number palindrome :: Integer -> Bool palindrome x = reversal x == x -- reversal function for calculating the reverse of the number reversal :: Integral a => a -> a reversal = go 0 where go a 0 = a go a b = let (q,r) = b `quotRem` 10 in go (a*10 + r) q