Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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)]
- emptyParameters :: Parameters
- 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).
Parameters [(CI ByteString, ByteString)] |
Instances
emptyParameters :: Parameters Source #
Same as mempty
, but useful where the type would otherwise be ambiguous.
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 #
ParameterValue (Maybe cs) (Maybe (CI ByteString)) a |
Instances
value :: Lens (ParameterValue cs a) (ParameterValue cs b) a b Source #
class HasParameters a where Source #
Types that have Parameters
parameters :: Lens' a Parameters Source #
Instances
HasParameters ContentDisposition Source # | |
Defined in Data.MIME | |
HasParameters ContentType Source # | |
Defined in Data.MIME | |
HasParameters Parameters Source # | |
Defined in Data.MIME.Parameter |