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

Safe HaskellNone
LanguageHaskell2010

Data.ByteString.Base64.Type

Description

Strict ByteString standard base64 encoding.

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 # 
Data ByteString64 Source # 

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 # 
Show ByteString64 Source # 
IsString ByteString64 Source # 
Generic ByteString64 Source # 

Associated Types

type Rep ByteString64 :: * -> * #

Semigroup ByteString64 Source # 
Monoid ByteString64 Source # 
Function ByteString64 Source # 

Methods

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

Arbitrary ByteString64 Source # 
CoArbitrary ByteString64 Source # 

Methods

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

Hashable ByteString64 Source # 
ToJSON ByteString64 Source # 
ToJSONKey ByteString64 Source # 
FromJSON ByteString64 Source # 
FromJSONKey ByteString64 Source # 
Binary ByteString64 Source #

ByteString64 is serialised as ByteString

Serialize ByteString64 Source #

ByteString64 is serialised as ByteString

NFData ByteString64 Source # 

Methods

rnf :: ByteString64 -> () #

type Rep ByteString64 Source # 
type Rep ByteString64 = D1 * (MetaData "ByteString64" "Data.ByteString.Base64.Type" "base64-bytestring-type-1-2dbTBevllHn4NtFnA0Vorp" True) (C1 * (MetaCons "BS64" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * ByteString)))

makeByteString64 :: ByteString -> ByteString64 Source #

Wrap ByteString into ByteString64. Essentially coerce.

Wrap ByteString into ByteString64. Essentially coerce.

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/"