The Modulus 10 algorithm works on sequences of digits, but since boths lists and integers can represent values that are invalid in this context there are some cases that will result in errors.
hasValidCheckDigit : List Basics.Int -> Result Error Basics.Bool
Check if the last digit in a sequence of digits is a valid check digit for the sequence according to the Modulus 10 algorithm.
hasValidCheckDigit [ 1, 2, 3 ] == Ok False
hasValidCheckDigit [ -2, 3 4 ] == Err NumbersOutOfRange
hasValidCheckDigit [] == Err EmptySequence
calculateCheckDigit : List Basics.Int -> Result Error Basics.Int
calculateCheckDigit the check digit for a given sequence of digits.