base64-bytestring-type-1.0.1: A newtype around ByteString, for base64 encoding

Safe HaskellNone
LanguageHaskell2010

Data.ByteString.Base64.URL.Type

Description

Strict ByteString base64 encoding with URL and filename safe alphabet.

See https://tools.ietf.org/html/rfc4648.

Synopsis

Documentation

data ByteString64 Source #

Aeson serialisable bytestring. Uses base64 encoding.

The inner ByteString is in raw format.

>>> let bs64 = makeByteString64 "foobar"
>>> bs64
mkBS64 "foobar"

Binary instance doesn't use base64 encoding:

>>> Binary.encode bs64
"\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ACKfoobar"

Aeson instance does:

>>> Aeson.encode bs64
"\"Zm9vYmFy\""

This module uses standard alphabet

>>> Aeson.encode (makeByteString64 "aa\191")
"\"YWG_\""
Instances
Eq ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Data ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString64 -> c ByteString64 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString64 #

toConstr :: ByteString64 -> Constr #

dataTypeOf :: ByteString64 -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteString64) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString64) #

gmapT :: (forall b. Data b => b -> b) -> ByteString64 -> ByteString64 #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString64 -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString64 -> r #

gmapQ :: (forall d. Data d => d -> u) -> ByteString64 -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString64 -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString64 -> m ByteString64 #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString64 -> m ByteString64 #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString64 -> m ByteString64 #

Ord ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Show ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

IsString ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Generic ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Associated Types

type Rep ByteString64 :: Type -> Type #

Semigroup ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Monoid ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Function ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Methods

function :: (ByteString64 -> b) -> ByteString64 :-> b #

Arbitrary ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

CoArbitrary ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Methods

coarbitrary :: ByteString64 -> Gen b -> Gen b #

Hashable ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

ToJSON ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

ToJSONKey ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

FromJSON ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

FromJSONKey ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Binary ByteString64 Source #

ByteString64 is serialised as ByteString

>>> Binary.encode (mkBS64 "foobar")
"\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ACKfoobar"
Instance details

Defined in Data.ByteString.Base64.URL.Type

Serialize ByteString64 Source #

ByteString64 is serialised as ByteString

>>> Cereal.encode (mkBS64 "foobar")
"\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ACKfoobar"
Instance details

Defined in Data.ByteString.Base64.URL.Type

NFData ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Methods

rnf :: ByteString64 -> () #

ToHttpApiData ByteString64 Source #
>>> HTTP.toUrlPiece (mkBS64 $ pack [164..192])
"pKWmp6ipqqusra6vsLGys7S1tre4ubq7vL2-v8A="
Instance details

Defined in Data.ByteString.Base64.URL.Type

FromHttpApiData ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

Serialise ByteString64 Source #
>>> Serialise.serialise (mkBS64 "xyzzy")
"Exyzzy"
Instance details

Defined in Data.ByteString.Base64.URL.Type

type Rep ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.URL.Type

type Rep ByteString64 = D1 (MetaData "ByteString64" "Data.ByteString.Base64.URL.Type" "base64-bytestring-type-1.0.1-JRgEVtUaTwmCogSCAy8IH7" True) (C1 (MetaCons "BS64" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString)))

getByteString64 :: ByteString64 -> ByteString Source #

Unwrap ByteString from ByteString64. Essentially coerce.

getEncodedByteString64 :: ByteString64 -> ByteString Source #

Get base64 encode bytestring

>>> getEncodedByteString64 "foobar"
"Zm9vYmFy"
>>> getEncodedByteString64 "aa\191"
"YWG_"