Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.MIME.Parameter
Description
MIME parameters, per RFC 2045 and RFC 2231.
RFC 2231 defines a mechanism for parameter continuations (for long
parameters), encoding of non-ASCII characters, and charset and
language annotation. The most common use of these capabilities is
in the Content-Disposition
header, for the filename
parameter.
This module provides types and functions for working with parameters.
Synopsis
- newtype Parameters = Parameters [(CI ByteString, ByteString)]
- parameterList :: HasParameters a => Lens' a RawParameters
- parameter :: HasParameters a => CI ByteString -> Lens' a (Maybe EncodedParameterValue)
- rawParameter :: HasParameters a => CI ByteString -> Traversal' a ByteString
- newParameter :: Cons s s Char Char => s -> EncodedParameterValue
- data ParameterValue cs a = ParameterValue (Maybe cs) (Maybe (CI ByteString)) a
- type EncodedParameterValue = ParameterValue CharsetName ByteString
- type DecodedParameterValue = ParameterValue Void Text
- value :: Lens (ParameterValue cs a) (ParameterValue cs b) a b
- class HasParameters a where
- parameters :: Lens' a Parameters
Documentation
newtype Parameters Source #
Header parameters. Used for some headers including Content-Type and Content-Disposition. This type handles parameter continuations and optional charset and language information (RFC 2231).
Constructors
Parameters [(CI ByteString, ByteString)] |
Instances
Eq Parameters Source # | |
Defined in Data.MIME.Parameter | |
Show Parameters Source # | |
Defined in Data.MIME.Parameter Methods showsPrec :: Int -> Parameters -> ShowS show :: Parameters -> String showList :: [Parameters] -> ShowS | |
Generic Parameters Source # | |
Defined in Data.MIME.Parameter Associated Types type Rep Parameters :: Type -> Type | |
Semigroup Parameters Source # | |
Defined in Data.MIME.Parameter Methods (<>) :: Parameters -> Parameters -> Parameters sconcat :: NonEmpty Parameters -> Parameters stimes :: Integral b => b -> Parameters -> Parameters | |
Monoid Parameters Source # | |
Defined in Data.MIME.Parameter Methods mempty :: Parameters mappend :: Parameters -> Parameters -> Parameters mconcat :: [Parameters] -> Parameters | |
At Parameters Source # | |
Defined in Data.MIME.Parameter Methods at :: Index Parameters -> Lens' Parameters (Maybe (IxValue Parameters)) | |
Ixed Parameters Source # | |
Defined in Data.MIME.Parameter Methods ix :: Index Parameters -> Traversal' Parameters (IxValue Parameters) | |
NFData Parameters Source # | |
Defined in Data.MIME.Parameter Methods rnf :: Parameters -> () | |
HasParameters Parameters Source # | |
Defined in Data.MIME.Parameter Methods parameters :: Lens' Parameters Parameters Source # | |
type Rep Parameters Source # | |
Defined in Data.MIME.Parameter type Rep Parameters = D1 (MetaData "Parameters" "Data.MIME.Parameter" "purebred-email-0.4.1-L0F8azWAfQWDl3u3WU0uwO" True) (C1 (MetaCons "Parameters" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(CI ByteString, ByteString)]))) | |
type Index Parameters Source # | |
Defined in Data.MIME.Parameter | |
type IxValue Parameters Source # | |
Defined in Data.MIME.Parameter |
parameterList :: HasParameters a => Lens' a RawParameters Source #
parameter :: HasParameters a => CI ByteString -> Lens' a (Maybe EncodedParameterValue) Source #
Access parameter value. Continuations, encoding and charset are processed.
rawParameter :: HasParameters a => CI ByteString -> Traversal' a ByteString Source #
Raw parameter. The key is used as-is. No processing of continuations, encoding or charset is performed.
newParameter :: Cons s s Char Char => s -> EncodedParameterValue Source #
Convenience function to construct a parameter value.
If you need to to specify language, use the ParameterValue
constructor directly.
data ParameterValue cs a Source #
Constructors
ParameterValue (Maybe cs) (Maybe (CI ByteString)) a |
Instances
IsString DecodedParameterValue Source # | Parameter value with no language. |
Defined in Data.MIME.Parameter Methods fromString :: String -> DecodedParameterValue | |
IsString EncodedParameterValue Source # | Parameter value with no language, encoded either in |
Defined in Data.MIME.Parameter Methods fromString :: String -> EncodedParameterValue | |
HasCharset EncodedParameterValue Source # | The default charset When encoding, 'utf-8' is always used, but if the whole string contains only ASCII characters then the charset declaration is omitted (so that it can be encoded as a non-extended parameter). |
Defined in Data.MIME.Parameter Associated Types type Decoded EncodedParameterValue :: Type Source # Methods charsetName :: Getter EncodedParameterValue (Maybe CharsetName) Source # charsetData :: Getter EncodedParameterValue ByteString Source # charsetDecoded :: AsCharsetError e => CharsetLookup -> forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Profunctor p, Contravariant f) => Optic' p f EncodedParameterValue (Either e (Decoded EncodedParameterValue)) Source # charsetEncode :: Decoded EncodedParameterValue -> EncodedParameterValue Source # | |
(Eq cs, Eq a) => Eq (ParameterValue cs a) Source # | |
Defined in Data.MIME.Parameter Methods (==) :: ParameterValue cs a -> ParameterValue cs a -> Bool (/=) :: ParameterValue cs a -> ParameterValue cs a -> Bool | |
(Show cs, Show a) => Show (ParameterValue cs a) Source # | |
Defined in Data.MIME.Parameter Methods showsPrec :: Int -> ParameterValue cs a -> ShowS show :: ParameterValue cs a -> String showList :: [ParameterValue cs a] -> ShowS | |
Generic (ParameterValue cs a) Source # | |
Defined in Data.MIME.Parameter Associated Types type Rep (ParameterValue cs a) :: Type -> Type Methods from :: ParameterValue cs a -> Rep (ParameterValue cs a) x to :: Rep (ParameterValue cs a) x -> ParameterValue cs a | |
(NFData cs, NFData a) => NFData (ParameterValue cs a) Source # | |
Defined in Data.MIME.Parameter Methods rnf :: ParameterValue cs a -> () | |
type Decoded EncodedParameterValue Source # | |
Defined in Data.MIME.Parameter | |
type Rep (ParameterValue cs a) Source # | |
Defined in Data.MIME.Parameter type Rep (ParameterValue cs a) = D1 (MetaData "ParameterValue" "Data.MIME.Parameter" "purebred-email-0.4.1-L0F8azWAfQWDl3u3WU0uwO" False) (C1 (MetaCons "ParameterValue" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe cs)) :*: (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe (CI ByteString))) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))) |
type EncodedParameterValue = ParameterValue CharsetName ByteString Source #
type DecodedParameterValue = ParameterValue Void Text Source #
value :: Lens (ParameterValue cs a) (ParameterValue cs b) a b Source #
class HasParameters a where Source #
Types that have Parameters
Methods
parameters :: Lens' a Parameters Source #
Instances
HasParameters Parameters Source # | |
Defined in Data.MIME.Parameter Methods parameters :: Lens' Parameters Parameters Source # | |
HasParameters ContentDisposition Source # | |
Defined in Data.MIME Methods parameters :: Lens' ContentDisposition Parameters Source # | |
HasParameters ContentType Source # | |
Defined in Data.MIME Methods parameters :: Lens' ContentType Parameters Source # |