Proposal: Make digitToInt and intToDigit work up to base 36

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sat Jun 30 00:26:05 CEST 2012


On 30 June 2012 07:44, Dan Burton <danburton.email at gmail.com> wrote:
> I could instead imagine
> the usefulness of alphaPos :: Alphabet ->  Char ->  Int which indicates what
> position a given character is in its alphabet (alphaPos English 'a' == 1,
> for instance), and its inverse alphaFromPos ::  Alphabet -> Int -> Char.

I find myself doing something along these lines (but usually with 'a'
-> 0) often enough that I would support adding such functions.

> But if I am trying to read a number from a String, I would almost certainly
> want it to fail on encountering any non-hex digit, rather than producing a
> strange number.

Agreed.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com



More information about the Libraries mailing list