{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Trustworthy #-}
module Data.ByteString.Short.Base16
( encodeBase16
, encodeBase16'
, decodeBase16
, decodeBase16Lenient
, isBase16
, isValidBase16
) where
import Data.ByteString.Short (ShortByteString, fromShort)
import Data.ByteString.Base16.Internal.Head
import qualified Data.ByteString.Base16 as B16
import Data.Text (Text)
import Data.Text.Short (ShortText)
import Data.Text.Short.Unsafe
encodeBase16 :: ShortByteString -> ShortText
encodeBase16 :: ShortByteString -> ShortText
encodeBase16 = ShortByteString -> ShortText
fromShortByteStringUnsafe (ShortByteString -> ShortText)
-> (ShortByteString -> ShortByteString)
-> ShortByteString
-> ShortText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortByteString -> ShortByteString
decodeBase16ShortLenient_
{-# INLINE encodeBase16 #-}
encodeBase16' :: ShortByteString -> ShortByteString
encodeBase16' :: ShortByteString -> ShortByteString
encodeBase16' = ShortByteString -> ShortByteString
encodeBase16Short_
{-# INLINE encodeBase16' #-}
decodeBase16 :: ShortByteString -> Either Text ShortByteString
decodeBase16 :: ShortByteString -> Either Text ShortByteString
decodeBase16 = ShortByteString -> Either Text ShortByteString
decodeBase16Short_
{-# INLINE decodeBase16 #-}
decodeBase16Lenient :: ShortByteString -> ShortByteString
decodeBase16Lenient :: ShortByteString -> ShortByteString
decodeBase16Lenient = ShortByteString -> ShortByteString
decodeBase16ShortLenient_
{-# INLINE decodeBase16Lenient #-}
isBase16 :: ShortByteString -> Bool
isBase16 :: ShortByteString -> Bool
isBase16 = ByteString -> Bool
B16.isBase16 (ByteString -> Bool)
-> (ShortByteString -> ByteString) -> ShortByteString -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortByteString -> ByteString
fromShort
{-# INLINE isBase16 #-}
isValidBase16 :: ShortByteString -> Bool
isValidBase16 :: ShortByteString -> Bool
isValidBase16 = ByteString -> Bool
B16.isValidBase16 (ByteString -> Bool)
-> (ShortByteString -> ByteString) -> ShortByteString -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortByteString -> ByteString
fromShort
{-# INLINE isValidBase16 #-}