Check if the last digit in a sequence of digits is a valid check digit for the sequence according to the Modulus 11 algorithm.
hasValidCheckDigit [3, 2, 4, 5, 5, 8] == Ok True
hasValidCheckDigit [ -2, 3 4 ] == Err NumbersOutOfRange
hasValidCheckDigit [] == Err EmptySequence
hasValidCheckDigit [0, 0, 0] = Err InvalidMod11NumberCalculate the "check digit" for a given sequence of digits.
calculateCheckDigit [ 1, 2, 3 ] == Ok 6
calculateCheckDigit [ 1, 2, 30 ] == Err NumbersOutOfRange
The Modulus 11 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.