<div dir="ltr"><div class="gmail_extra">Well, toDigits is always finishing its work after dividing the input number once, and always returns lists of at most one element. You need it to call itself recursively until it's done, and append the calculated digit to the result:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><span class="im" style="font-size:12.8000001907349px">toDigits :: Integer -> [Integer]<br>toDigits n<br>  | n <= 0 = []<br></span><span style="font-size:12.8000001907349px">  | otherwise = n `mod` 10 : toDigits (n `div` 10)</span><br></div><div class="gmail_extra"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_extra"><span style="font-size:12.8000001907349px">The <= is necessary, otherwise the function would loop infinitely on 0. This version will print the digits in reverse, so you might move the code to a local function in toDigits, and make toDigit call it and then reverse the result.</span></div><div class="gmail_extra"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_extra"><span style="font-size:12.8000001907349px">I'd strongly recommend reading a Haskell tutorial (for example <a href="http://learnyouahaskell.com">http://learnyouahaskell.com</a> ) to learn the basics.</span></div><div class="gmail_extra"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_extra"><span style="font-size:12.8000001907349px">Kind regards,</span></div><div class="gmail_extra"><span style="font-size:12.8000001907349px">Marcin Mrotek</span></div></div>