module Data.ByteString.Short.Base16
( encodeBase16
, encodeBase16'
, decodeBase16
, decodeBase16'
, decodeBase16Untyped
, decodeBase16Lenient
, isBase16
, isValidBase16
) where
import Data.Base16.Types
import Data.ByteString.Short
import Data.ByteString.Base16.Internal.Head
import qualified Data.ByteString.Base16 as B16
import Data.Text (Text)
import Data.Text.Short
import Data.Text.Short.Unsafe
encodeBase16 :: ShortByteString -> Base16 ShortText
encodeBase16 :: ShortByteString -> Base16 ShortText
encodeBase16 = (ShortByteString -> ShortText)
-> Base16 ShortByteString -> Base16 ShortText
forall a b. (a -> b) -> Base16 a -> Base16 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ShortByteString -> ShortText
fromShortByteStringUnsafe (Base16 ShortByteString -> Base16 ShortText)
-> (ShortByteString -> Base16 ShortByteString)
-> ShortByteString
-> Base16 ShortText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortByteString -> Base16 ShortByteString
encodeBase16'
{-# INLINE encodeBase16 #-}
encodeBase16' :: ShortByteString -> Base16 ShortByteString
encodeBase16' :: ShortByteString -> Base16 ShortByteString
encodeBase16' = ShortByteString -> Base16 ShortByteString
forall a. a -> Base16 a
assertBase16 (ShortByteString -> Base16 ShortByteString)
-> (ShortByteString -> ShortByteString)
-> ShortByteString
-> Base16 ShortByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShortByteString -> ShortByteString
encodeBase16Short_
{-# INLINE encodeBase16' #-}
decodeBase16 :: Base16 ShortByteString -> ShortByteString
decodeBase16 :: Base16 ShortByteString -> ShortByteString
decodeBase16 = Base16 ShortByteString -> ShortByteString
decodeBase16ShortTyped_
{-# INLINE decodeBase16 #-}
decodeBase16' :: Base16 ShortText -> ShortByteString
decodeBase16' :: Base16 ShortText -> ShortByteString
decodeBase16' = Base16 ShortByteString -> ShortByteString
decodeBase16 (Base16 ShortByteString -> ShortByteString)
-> (Base16 ShortText -> Base16 ShortByteString)
-> Base16 ShortText
-> ShortByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ShortText -> ShortByteString)
-> Base16 ShortText -> Base16 ShortByteString
forall a b. (a -> b) -> Base16 a -> Base16 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ShortText -> ShortByteString
toShortByteString
{-# INLINE decodeBase16' #-}
decodeBase16Untyped :: ShortByteString -> Either Text ShortByteString
decodeBase16Untyped :: ShortByteString -> Either Text ShortByteString
decodeBase16Untyped = ShortByteString -> Either Text ShortByteString
decodeBase16Short_
{-# INLINE decodeBase16Untyped #-}
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 #-}