module Data.ByteString.Short.Base16
( encodeBase16
, encodeBase16'
, decodeBase16
, decodeBase16'
, decodeBase16Untyped
, decodeBase16Lenient
, parseBase16
) where
import Data.Base16.Types
import Data.ByteString.Short
import Data.ByteString.Base16.Internal.Head
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 #-}
parseBase16 :: ShortByteString -> Either Text (Base16 ShortByteString)
parseBase16 :: ShortByteString -> Either Text (Base16 ShortByteString)
parseBase16 ShortByteString
bs = ShortByteString -> Base16 ShortByteString
forall a. a -> Base16 a
assertBase16 ShortByteString
bs Base16 ShortByteString
-> Either Text ShortByteString
-> Either Text (Base16 ShortByteString)
forall a b. a -> Either Text b -> Either Text a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ShortByteString -> Either Text ShortByteString
decodeBase16Untyped ShortByteString
bs
{-# INLINE parseBase16 #-}