I'm not conversant in Haskell, but this probably won't work on American Express card numbers - they have 15 digits, the final digit is still the Luhn checksum.
I did credit card processing 20 years ago - AmEx was very often the fly in the ointment.
The above code should work for any number of digits. It follows the spec given in the article, specifically:
1. Write out all but the last digit of the card number.
2. Write out all but the last digit of the card number.
3. Starting from the right, double every other number.
Expressed in Haskell:
I'm not conversant in Haskell, but this probably won't work on American Express card numbers - they have 15 digits, the final digit is still the Luhn checksum.
I did credit card processing 20 years ago - AmEx was very often the fly in the ointment.
The above code should work for any number of digits. It follows the spec given in the article, specifically: