Safe Haskell | Safe-Inferred |
---|
Defines the media type types and functions.
- data MediaType
- type Parameters = Map ByteString ByteString
- (//) :: ByteString -> ByteString -> MediaType
- (/:) :: MediaType -> (ByteString, ByteString) -> MediaType
- parse :: ByteString -> Maybe MediaType
- toByteString :: MediaType -> ByteString
- mainType :: MediaType -> ByteString
- subType :: MediaType -> ByteString
- parameters :: MediaType -> Parameters
- (/?) :: MediaType -> ByteString -> Bool
- (/.) :: MediaType -> ByteString -> Maybe ByteString
Type and creation
An HTTP media type, consisting of the type, subtype, and parameters.
type Parameters = Map ByteString ByteStringSource
MediaType
parameters.
(//) :: ByteString -> ByteString -> MediaTypeSource
Builds a MediaType
without parameters. Can produce an error if
either type is invalid.
(/:) :: MediaType -> (ByteString, ByteString) -> MediaTypeSource
Adds a parameter to a MediaType
. Can produce an error if either
string is invalid.
toByteString :: MediaType -> ByteStringSource
Converts MediaType
to ByteString
.
Querying
mainType :: MediaType -> ByteStringSource
Retrieves the main type of a MediaType
.
subType :: MediaType -> ByteStringSource
Retrieves the sub type of a MediaType
.
parameters :: MediaType -> ParametersSource
Retrieves the parameters of a MediaType
.
(/?) :: MediaType -> ByteString -> BoolSource
Evaluates if a MediaType
has a parameter of the given name.
(/.) :: MediaType -> ByteString -> Maybe ByteStringSource
Retrieves a parameter from a MediaType
.