Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Num to constraints with Bits

Bits no longer implies Num as of GHC 7.5
  • Loading branch information...
commit f31810517ee34c894286e0b9566f87eaaafd5f09 1 parent 451b347
@bgamari bgamari authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 OpenSSL/Utils.hs
View
4 OpenSSL/Utils.hs
@@ -45,7 +45,7 @@ raiseOpenSSLError :: IO a
raiseOpenSSLError = getError >>= errorString >>= fail
-- | Convert an integer to a hex string
-toHex :: (Bits i) => i -> String
+toHex :: (Num i, Bits i) => i -> String
toHex = reverse . map hexByte . unfoldr step where
step 0 = Nothing
step i = Just (i .&. 0xf, i `shiftR` 4)
@@ -69,7 +69,7 @@ toHex = reverse . map hexByte . unfoldr step where
hexByte _ = undefined
-- | Convert a hex string to an integer
-fromHex :: (Bits i) => String -> i
+fromHex :: (Num i, Bits i) => String -> i
fromHex = foldl step 0 where
step acc hexchar = (acc `shiftL` 4) .|. byteHex hexchar
Please sign in to comment.
Something went wrong with that request. Please try again.