moduleData.Digits(digits,digitsRev,unDigits,prop_digitsRoundTrip)whereimportTest.QuickCheck-- | Returns the digits of a positive integer as a list, in reverse order.-- This is slightly more efficient than in forward order.digitsRev::Integraln=>n-- ^ The base to use.->n-- ^ The number to convert to digit form.->[n]-- ^ The digits of the number in list form, in reverse.digitsRevbasei=caseiof0->[]_->lastDigit:digitsRevbaserestwhere(rest,lastDigit)=quotRemibase-- | Returns the digits of a positive integer as a list.digits::Integraln=>n-- ^ The base to use (typically 10).->n-- ^ The number to convert to digit form.->[n]-- ^ The digits of the number in list form.digitsbase=reverse.digitsRevbase-- | Takes a list of digits, and converts them back into a positive integer.unDigits::Integraln=>n-- ^ The base to use.->[n]-- ^ The digits of the number in list form.->n-- ^ The original number.unDigitsbase=foldl(\ab->a*base+b)0-- | unDigits . digits should be the identity, in any base.prop_digitsRoundTrip::Integer-- ^ The integer to test.->Integer-- ^ The base to use.->Propertyprop_digitsRoundTripib=i>0==>b>1==>i==(unDigitsb.digitsb)i