Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
MIME content transfer encodings.
Synopsis
- class HasTransferEncoding a where
- type TransferDecoded a
- transferEncodingName :: Getter a TransferEncodingName
- transferEncodedData :: Getter a ByteString
- transferDecoded :: (AsTransferEncodingError e, Profunctor p, Contravariant f) => Optic' p f a (Either e (TransferDecoded a))
- transferDecoded' :: (Profunctor p, Contravariant f) => Optic' p f a (Either TransferEncodingError (TransferDecoded a))
- transferEncode :: TransferDecoded a -> a
- type TransferEncodingName = CI ByteString
- transferDecodedBytes :: (HasTransferEncoding a, AsTransferEncodingError e, Profunctor p, Contravariant f) => Optic' p f a (Either e ByteString)
- transferEncodings :: [(CI ByteString, TransferEncoding)]
- data TransferEncodingError
- class AsTransferEncodingError s where
- type TransferEncoding = APrism' ByteString ByteString
- chooseTransferEncoding :: ByteString -> (TransferEncodingName, TransferEncoding)
Documentation
class HasTransferEncoding a where Source #
Data types that can have transfer encoding.
type TransferDecoded a Source #
transferEncodingName :: Getter a TransferEncodingName Source #
Get the declared or default transfer encoding name.
transferEncodedData :: Getter a ByteString Source #
Return the encoded data in the structure.
transferDecoded :: (AsTransferEncodingError e, Profunctor p, Contravariant f) => Optic' p f a (Either e (TransferDecoded a)) Source #
Perform content transfer decoding.
transferDecoded' :: (Profunctor p, Contravariant f) => Optic' p f a (Either TransferEncodingError (TransferDecoded a)) Source #
Perform content transfer decoding (monomorphic error type).
transferEncode :: TransferDecoded a -> a Source #
Encode the data
Instances
type TransferEncodingName = CI ByteString Source #
transferDecodedBytes :: (HasTransferEncoding a, AsTransferEncodingError e, Profunctor p, Contravariant f) => Optic' p f a (Either e ByteString) Source #
Decode the object according to the declared content transfer encoding.
transferEncodings :: [(CI ByteString, TransferEncoding)] Source #
Get the Content-Transfer-Encoding for an entity.
Defaults to 7bit
(RFC 2045 §6.1) if the header is
not present. Fails on unrecognised values.
data TransferEncodingError Source #
Instances
class AsTransferEncodingError s where Source #
_TransferEncodingError :: Prism' s TransferEncodingError Source #
_TransferEncodingUnsupported :: Prism' s TransferEncodingName Source #
_TransferDecodeError :: Prism' s TransferEncodingName Source #
chooseTransferEncoding :: ByteString -> (TransferEncodingName, TransferEncoding) Source #
Inspect the data and choose a transfer encoding to use: 7bit
if the data can be transmitted as-is, otherwise whichever of
quoted-printable
or base64
should result in smaller output.