| Copyright | (c) Dong Han 2017-2018 |
|---|---|
| License | BSD |
| Maintainer | winterland1989@gmail.com |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Z.Data.Vector.Hex
Description
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.
Constructors
| HexBytes | |
Fields
| |
Encoding & Decoding functions
Encode Bytes using hex(base16) encoding.
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.
Constructors
| IllegalHexBytes Bytes CallStack | |
| IncompleteHexBytes Bytes CallStack |
Instances
| Show HexDecodeException Source # | |
Defined in Z.Data.Vector.Hex Methods showsPrec :: Int -> HexDecodeException -> ShowS # show :: HexDecodeException -> String # showList :: [HexDecodeException] -> ShowS # | |
| Exception HexDecodeException Source # | |
Defined in Z.Data.Vector.Hex Methods toException :: HexDecodeException -> SomeException # fromException :: SomeException -> Maybe HexDecodeException # | |