digits-0.3: Converts integers to lists of digits and back.

Data.Digits

Synopsis

# Documentation

Arguments

 :: Integral n => n The base to use. -> n The number to convert to digit form. -> Maybe [n] Nothing or Just the digits of the number in list form

Returns the digits of a positive integer as a Maybe list. or Nothing if a negative base is given

Arguments

 :: Integral n => n The base to use (typically 10). -> n The number to convert to digit form. -> [n] Either Nothing or the digits of the number in list form.

Returns the digits of a positive integer as a list. Throws an error if given a negative base.

Arguments

 :: Integral n => n The base to use. -> n The number to convert to digit form. -> Maybe [n] Nothing or Just the digits of the number in list form, in reverse.

Returns the digits of a positive integer as a Maybe list, in reverse order or Nothing if a negative base is given This is slightly more efficient than in forward order.

Arguments

 :: Integral n => n The base to use. -> n The number to convert to digit from. -> [n] The digits of the number in list from, in reverse.

Returns the digits of a positive integer as a list, in reverse order. Throws an error if given a negative base.

Arguments

 :: Integral n => n The base to use. -> [n] The digits of the number in list form. -> n The original number.

Takes a list of digits, and converts them back into a positive integer.

Arguments

 :: Integer The integer to test. -> Integer The base to use. -> Property

unDigits . digits should be the identity, in any positive base.