Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- showNatural :: HexStringSuperset string => Case -> Natural -> string
- readNatural :: HexStringSuperset string => string -> Maybe Natural
- showInteger :: StringSuperset string => Case -> Integer -> string
- readInteger :: StringSuperset string => string -> Maybe Integer
- showIntegral :: (StringSuperset string, Integral number) => Case -> number -> string
- readIntegral :: (StringSuperset string, Integral number, Bits number) => string -> Maybe number
- data D16
- data HexChar
- data HexLetter
- data HexCharBreakdown
- hexLetterD16 :: HexLetter -> D16
- d16HexLetter :: D16 -> Maybe HexLetter
- letterHexChar :: Case -> HexLetter -> HexChar
- hexCharLetter :: HexChar -> Maybe HexLetter
- hexAsciiChar :: HexChar -> Char
- asciiCharHex :: Char -> Maybe HexChar
- d16HexChar :: Case -> D16 -> HexChar
- hexCharD16 :: HexChar -> D16
- breakDownHexChar :: HexChar -> HexCharBreakdown
- assembleHexChar :: HexCharBreakdown -> HexChar
- class HexCharSuperset char where
- fromHexChar :: HexChar -> char
- isHexChar :: char -> Bool
- toHexCharUnsafe :: char -> HexChar
- toHexCharMaybe :: char -> Maybe HexChar
- class HexStringSuperset string where
- fromHexCharList :: [HexChar] -> string
- isHexString :: string -> Bool
- toHexCharListUnsafe :: string -> [HexChar]
- toHexCharListMaybe :: string -> Maybe [HexChar]
- naturalHexCharMaybe :: Case -> Natural -> Maybe HexChar
- hexCharNatural :: HexChar -> Natural
- naturalHexCharUnsafe :: Case -> Natural -> HexChar
- naturalD16Maybe :: Natural -> Maybe D16
- d16Natural :: D16 -> Natural
- naturalD16Unsafe :: Natural -> D16
- integerHexCharMaybe :: Case -> Integer -> Maybe HexChar
- hexCharInteger :: HexChar -> Integer
- integerHexCharUnsafe :: Case -> Integer -> HexChar
- integerD16Maybe :: Integer -> Maybe D16
- d16Integer :: D16 -> Integer
- integerD16Unsafe :: Integer -> D16
Read/show for numeric strings
Natural
showNatural :: HexStringSuperset string => Case -> Natural -> string Source #
Examples:
showNatural LowerCase 12
="c"
showNatural UpperCase (256 + 12)
="10C"
showNatural UpperCase 0
="0"
readNatural :: HexStringSuperset string => string -> Maybe Natural Source #
Examples:
readNatural "5"
=Just 5
readNatural "-5"
=Nothing
readNatural "1f"
=Just 31
readNatural "1F"
=Just 31
readNatural "xa"
=Nothing
readNatural ""
=Nothing
Integer
showInteger :: StringSuperset string => Case -> Integer -> string Source #
Examples:
showInteger LowerCase 12
="c"
showInteger LowerCase (negate 12)
="-c"
showInteger UpperCase (256 + 12)
="10C"
showInteger UpperCase (negate (256 + 12))
="-10C"
showInteger UpperCase 0
="0"
readInteger :: StringSuperset string => string -> Maybe Integer Source #
Examples:
readInteger "5"
=Just 5
readInteger "-5"
=Just (-5)
readInteger "1f"
=Just 31
readInteger "1F"
=Just 31
readInteger "xa"
=Nothing
readInteger ""
=Nothing
readInteger "-"
=Nothing
Integral
showIntegral :: (StringSuperset string, Integral number) => Case -> number -> string Source #
readIntegral :: (StringSuperset string, Integral number, Bits number) => string -> Maybe number Source #
Examples:
readIntegral "0014"
=Just (20 :: Word8)
readIntegral ""
=(Nothing :: Maybe Word8)
readIntegral "-4"
=(Nothing :: Maybe Word8)
readIntegral "1234"
=(Nothing :: Maybe Word8)
Various digit types
A whole number between 0 and 15
D0 | Zero |
D1 | One |
D2 | Two |
D3 | Three |
D4 | Four |
D5 | Five |
D6 | Six |
D7 | Seven |
D8 | Eight |
D9 | Nine |
D10 | Ten (A) |
D11 | Eleven (B) |
D12 | Twelve (C) |
D13 | Thirteen (D) |
D14 | Fourteen (E) |
D15 | Fifteen (F) |
Instances
Bounded D16 Source # | |
Enum D16 Source # | |
Eq D16 Source # | |
Data D16 Source # | |
Defined in ASCII.Hexadecimal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> D16 -> c D16 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c D16 # dataTypeOf :: D16 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c D16) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c D16) # gmapT :: (forall b. Data b => b -> b) -> D16 -> D16 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> D16 -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> D16 -> r # gmapQ :: (forall d. Data d => d -> u) -> D16 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> D16 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> D16 -> m D16 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> D16 -> m D16 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> D16 -> m D16 # | |
Ord D16 Source # | |
Show D16 Source # | |
Generic D16 Source # | |
Hashable D16 Source # | |
Defined in ASCII.Hexadecimal | |
type Rep D16 Source # | |
Defined in ASCII.Hexadecimal type Rep D16 = D1 ('MetaData "D16" "ASCII.Hexadecimal" "ascii-numbers-1.0.0.0-Ph9fR7aOEX2uBqj267gHs" 'False) ((((C1 ('MetaCons "D0" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D1" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "D2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D3" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "D4" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D5" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "D6" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D7" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "D8" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D9" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "D10" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D11" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "D12" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D13" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "D14" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "D15" 'PrefixI 'False) (U1 :: Type -> Type))))) |
The subset of ASCII used to represent hexadecimal numbers:
Instances
Bounded HexChar Source # | |
Enum HexChar Source # | |
Eq HexChar Source # | |
Data HexChar Source # | |
Defined in ASCII.Hexadecimal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HexChar -> c HexChar # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HexChar # toConstr :: HexChar -> Constr # dataTypeOf :: HexChar -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HexChar) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HexChar) # gmapT :: (forall b. Data b => b -> b) -> HexChar -> HexChar # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HexChar -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HexChar -> r # gmapQ :: (forall d. Data d => d -> u) -> HexChar -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HexChar -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HexChar -> m HexChar # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HexChar -> m HexChar # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HexChar -> m HexChar # | |
Ord HexChar Source # | |
Show HexChar Source # | |
Generic HexChar Source # | |
Hashable HexChar Source # | |
Defined in ASCII.Hexadecimal | |
HexCharSuperset HexChar Source # | |
HexStringSuperset [HexChar] Source # | |
Defined in ASCII.Hexadecimal | |
type Rep HexChar Source # | |
Defined in ASCII.Hexadecimal type Rep HexChar = D1 ('MetaData "HexChar" "ASCII.Hexadecimal" "ascii-numbers-1.0.0.0-Ph9fR7aOEX2uBqj267gHs" 'False) ((((C1 ('MetaCons "Digit0" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Digit1" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Digit2" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Digit3" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Digit4" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Digit5" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Digit6" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Digit7" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Digit8" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Digit9" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CapitalLetterA" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "CapitalLetterB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CapitalLetterC" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CapitalLetterD" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CapitalLetterE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CapitalLetterF" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "SmallLetterA" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SmallLetterB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SmallLetterC" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "SmallLetterD" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SmallLetterE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SmallLetterF" 'PrefixI 'False) (U1 :: Type -> Type)))))) |
Letters used as hexadecimal digits above 9, without a notion of case.
Instances
Bounded HexLetter Source # | |
Enum HexLetter Source # | |
Defined in ASCII.Hexadecimal succ :: HexLetter -> HexLetter # pred :: HexLetter -> HexLetter # fromEnum :: HexLetter -> Int # enumFrom :: HexLetter -> [HexLetter] # enumFromThen :: HexLetter -> HexLetter -> [HexLetter] # enumFromTo :: HexLetter -> HexLetter -> [HexLetter] # enumFromThenTo :: HexLetter -> HexLetter -> HexLetter -> [HexLetter] # | |
Eq HexLetter Source # | |
Data HexLetter Source # | |
Defined in ASCII.Hexadecimal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HexLetter -> c HexLetter # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HexLetter # toConstr :: HexLetter -> Constr # dataTypeOf :: HexLetter -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HexLetter) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HexLetter) # gmapT :: (forall b. Data b => b -> b) -> HexLetter -> HexLetter # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HexLetter -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HexLetter -> r # gmapQ :: (forall d. Data d => d -> u) -> HexLetter -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HexLetter -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HexLetter -> m HexLetter # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HexLetter -> m HexLetter # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HexLetter -> m HexLetter # | |
Ord HexLetter Source # | |
Defined in ASCII.Hexadecimal | |
Show HexLetter Source # | |
Generic HexLetter Source # | |
Hashable HexLetter Source # | |
Defined in ASCII.Hexadecimal | |
type Rep HexLetter Source # | |
Defined in ASCII.Hexadecimal type Rep HexLetter = D1 ('MetaData "HexLetter" "ASCII.Hexadecimal" "ascii-numbers-1.0.0.0-Ph9fR7aOEX2uBqj267gHs" 'False) ((C1 ('MetaCons "LetterA" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LetterB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LetterC" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "LetterD" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "LetterE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LetterF" 'PrefixI 'False) (U1 :: Type -> Type)))) |
data HexCharBreakdown Source #
Instances
Monomorphic character conversions
HexLetter ↔ D16
hexLetterD16 :: HexLetter -> D16 Source #
HexLetter ↔ HexChar
HexChar ↔ ASCII Char
hexAsciiChar :: HexChar -> Char Source #
HexChar ↔ D16
hexCharD16 :: HexChar -> D16 Source #
HexChar ↔ HexCharBreakdown
Hexadecimal character superset classes
Of hex character
class HexCharSuperset char where Source #
fromHexChar :: HexChar -> char Source #
isHexChar :: char -> Bool Source #
toHexCharUnsafe :: char -> HexChar Source #
toHexCharMaybe :: char -> Maybe HexChar Source #
Instances
Of hex character lists
class HexStringSuperset string where Source #
fromHexCharList :: [HexChar] -> string Source #
isHexString :: string -> Bool Source #
toHexCharListUnsafe :: string -> [HexChar] Source #
toHexCharListMaybe :: string -> Maybe [HexChar] Source #
Instances
Character/number conversions
Natural ↔ HexChar
hexCharNatural :: HexChar -> Natural Source #
Natural ↔ D16
d16Natural :: D16 -> Natural Source #
naturalD16Unsafe :: Natural -> D16 Source #
Integer ↔ HexChar
hexCharInteger :: HexChar -> Integer Source #
Integer ↔ D16
d16Integer :: D16 -> Integer Source #
integerD16Unsafe :: Integer -> D16 Source #