hexNum :: ReadP Word -- we are fixing the type to what we need
hexNum = do string "0x"
            ds <- munch hexDigit
            return (read ("0x" ++ ds))
  where hexDigit = (\x -> x `elem` "0123456789abcdefABCDEF")

------------------------------------------------------------------
-- Binary instance, and some convenience wrappers

-- we make our life simple and construct/deconstruct Word (U)Arrays,
-- quite as we did in the Show/Read instances above already. The
-- TypeRep, however, has to be shown to a string to serialize.
hexNum :: ReadP Word
hexNum = do string "0x"
            ds <- munch hexDigit
            return (read ("0x" ++ ds))
  where hexDigit = (\x -> x `elem` "0123456789abcdefABCDEF")

------------------------------------------------------------------
-- Binary instance, and some convenience wrappers

-- we make our life simple and construct/deconstruct Word (U)Arrays,
-- quite as we did in the Show/Read instances above already. The
-- TypeRep, however, has to be shown to a string to serialize.
hexNum = do string "0x"
            ds <- munch hexDigit
            return (read ("0x" ++ ds))
  where hexDigit = (\x -> x `elem` "0123456789abcdefABCDEF")

------------------------------------------------------------------
-- Binary instance, and some convenience wrappers

-- we make our life simple and construct/deconstruct Word (U)Arrays,
-- quite as we did in the Show/Read instances above already. The
-- TypeRep, however, has to be shown to a string to serialize.