------------------------------------------------------------------------------------------------------------------------------
-- Lab 2: Validating Credit Card Numbers
------------------------------------------------------------------------------------------------------------------------------

-- ===================================
-- Ex. 0
-- ===================================

toDigits :: Integer -> [Integer]
toDigits n 
    | n >= 0 && n < 10  = [n]
    | n >= 10           = toDigits (n `div` 10) ++ [n `mod` 10]
    | otherwise         = error "n >= 0"
toDigits :: Integer -> [Integer]
toDigits n 
    | n >= 0 && n < 10  = [n]
    | n >= 10           = toDigits (n `div` 10) ++ [n `mod` 10]
    | otherwise         = error "n >= 0"
toDigits n 
    | n >= 0 && n < 10  = [n]
    | n >= 10           = toDigits (n `div` 10) ++ [n `mod` 10]
    | otherwise         = error "n >= 0"