Copyright | (c) Dong Han 2017-2018 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides hex encoding & decoding tools, as well as HexBytes
newtype with hex textual instances.
Synopsis
- newtype HexBytes = HexBytes {
- unHexBytes :: Bytes
- hexEncode :: Bool -> Bytes -> Bytes
- hexEncodeText :: Bool -> Bytes -> Text
- hexEncodeBuilder :: Bool -> Bytes -> Builder ()
- hexDecode :: Bytes -> Maybe Bytes
- hexDecode' :: HasCallStack => Bytes -> Bytes
- data HexDecodeException
- hs_hex_encode :: MBA# Word8 -> Int -> BA# Word8 -> Int -> Int -> IO ()
- hs_hex_encode_upper :: MBA# Word8 -> Int -> BA# Word8 -> Int -> Int -> IO ()
- hs_hex_decode :: MBA# Word8 -> BA# Word8 -> Int -> Int -> IO Int
The HexBytes type
New type wrapper for Bytes
with hex encoding(uppercase) Show/JSON instances.
Instances
Eq HexBytes Source # | |
Ord HexBytes Source # | |
Defined in Z.Data.Vector.Hex | |
Show HexBytes Source # | |
Semigroup HexBytes Source # | |
Monoid HexBytes Source # | |
Hashable HexBytes Source # | |
Defined in Z.Data.Vector.Hex | |
ShowT HexBytes Source # | |
Defined in Z.Data.Vector.Hex | |
FromValue HexBytes Source # | |
EncodeJSON HexBytes Source # | |
Defined in Z.Data.Vector.Hex encodeJSON :: HexBytes -> Builder () Source # | |
ToValue HexBytes Source # | |
Encoding & Decoding functions
hexDecode :: Bytes -> Maybe Bytes Source #
Decode a hex encoding string, return Nothing on illegal bytes or incomplete input.
hexDecode' :: HasCallStack => Bytes -> Bytes Source #
Decode a hex encoding string, throw HexDecodeException
on error.
data HexDecodeException Source #
Exception during hex decoding.
Instances
Show HexDecodeException Source # | |
Defined in Z.Data.Vector.Hex showsPrec :: Int -> HexDecodeException -> ShowS # show :: HexDecodeException -> String # showList :: [HexDecodeException] -> ShowS # | |
Exception HexDecodeException Source # | |
Defined in Z.Data.Vector.Hex |