I have the string \"1001\" and I want the string \"9\".
The numeric library has the (rather clunky) showIntAtBase, but I haven\'t been able to find the opposite.
From PLEAC:
bin2dec :: String -> Integer bin2dec = foldr (\c s -> s * 2 + c) 0 . reverse . map c2i where c2i c = if c == '0' then 0 else 1