import Data.Char (digitToInt) factorial :: Integer -> Integer factorial 1 = 1 factorial x = x * factorial (x - 1) sumDigits :: Integer -> Int sumDigits = sum . map digitToInt . show