
13 Nov
2005
13 Nov
'05
9:16 a.m.
On 11/13/05, Daan Leijen
Dominic Steinitz wrote:
I often find myself wanting to print out hex values as a string. I couldn't
Me too! And I also often want to see binary values (ie. 13 == 0x0D == 0b1101)
Just some information: I remember that there is a 'showHex' function in the "NumExts" module in Ghc (at least in version 5.x). See:
http://www.haskell.org/ghc/docs/latest/html/hslibs/sec-NumExts.html
It's now Numeric from the 'base' package: http://haskell.org/ghc/docs/latest/html/libraries/base/Numeric.html Prelude> Numeric.showIntAtBase 2 Char.intToDigit 99 "" "1100011" Prelude> Numeric.showHex 30 "" "1e" -- Friendly, Lemmih