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

Data.Digits

Synopsis

Documentation

digitsSource

Arguments

:: Integral n 
=> n

The base to use (typically 10).

-> n

The number to convert to digit form.

-> [n]

The digits of the number in list form.

Returns the digits of a positive integer as a list.

digitsRevSource

Arguments

:: Integral n 
=> n

The base to use.

-> n

The number to convert to digit form.

-> [n]

The digits of the number in list form, in reverse.

Returns the digits of a positive integer as a list, in reverse order. This is slightly more efficient than in forward order.

unDigitsSource

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.

prop_digitsRoundTripSource

Arguments

:: Integer

The integer to test.

-> Integer

The base to use.

-> Property 

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