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

Safe HaskellNone
LanguageHaskell2010

Data.ByteString.Base64.Lazy.Type

Description

Lazy 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 # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Data ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.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.Lazy.Type

Show ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

IsString ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Generic ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Associated Types

type Rep ByteString64 :: Type -> Type #

Semigroup ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Monoid ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Function ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Methods

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

Arbitrary ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

CoArbitrary ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Methods

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

Hashable ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

ToJSON ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

ToJSONKey ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

FromJSON ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

FromJSONKey ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.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.Lazy.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.Lazy.Type

NFData ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

Methods

rnf :: ByteString64 -> () #

Serialise ByteString64 Source #
>>> Serialise.serialise (mkBS64 "xyzzy")
"_Exyzzy\255"
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

type Rep ByteString64 Source # 
Instance details

Defined in Data.ByteString.Base64.Lazy.Type

type Rep ByteString64 = D1 (MetaData "ByteString64" "Data.ByteString.Base64.Lazy.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/"