Sha256: f2e4da29d9fc568ec32c021c9506011b47591174d51adb72e5738ed8b73ecba8
Contents?: true
Size: 524 Bytes
Versions: 396
Compression:
Stored size: 524 Bytes
Contents
module Hexadecimal (hexToInt) where {-# ANN digitToInt "HLint: ignore Use isDigit" #-} digitToInt :: Char -> Maybe Int digitToInt c | c >= '0' && c <= '9' = Just $ n - fromEnum '0' | c >= 'a' && c <= 'f' = Just $ n - fromEnum 'a' + 10 | c >= 'A' && c <= 'F' = Just $ n - fromEnum 'A' + 10 | otherwise = Nothing where n = fromEnum c hexToInt :: String -> Int hexToInt = go 0 where go acc (c:cs) = case digitToInt c of Just n -> (go $! acc * 16 + n) cs _ -> 0 go acc [] = acc
Version data entries
396 entries across 396 versions & 1 rubygems