http-media-0.2.0: Processing HTTP Content-Type and Accept headers

Safe HaskellSafe-Inferred

Network.HTTP.Media.Accept

Description

Defines the Accept type class, designed to unify types on the matching functions in the Media module.

Synopsis

Documentation

class Show a => Accept a whereSource

Defines methods for a type whose values can be matched against each other in terms of an HTTP Accept-* header.

This allows functions to work on both the standard Accept header and others such as Accept-Language that still may use quality values.

Methods

parseAccept :: ByteString -> Maybe aSource

Specifies how to parse an Accept-* header after quality has been handled.

showAccept :: a -> StringSource

Specifies how to show an Accept-* header. Defaults to the standard show method.

Mostly useful just for avoiding quotes when rendering ByteStrings with accompanying quality.

matches :: a -> a -> BoolSource

Evaluates whether either the left argument matches the right one (order may be important).

moreSpecificThan :: a -> a -> BoolSource

Evaluates whether the left argument is more specific than the right.

mostSpecific :: Accept a => a -> a -> aSource

Evaluates to whichever argument is more specific. Left biased.