diff --git a/src/Data/HexString.hs b/src/Data/HexString.hs index 273a70a..f0b5d79 100644 --- a/src/Data/HexString.hs +++ b/src/Data/HexString.hs @@ -80,6 +80,10 @@ fromBytes = hexString . BS16.encode toBytes :: HexString -> BS.ByteString toBytes (HexString bs) = BS16.decodeLenient bs +-- | Reads a human-readable hex string into a `HexString` +fromText :: T.Text -> HexString +fromText = hexString . TE.encodeUtf8 + -- | Access to a 'T.Text' representation of the 'HexString' toText :: HexString -> T.Text toText (HexString bs) = TE.decodeUtf8 bs