Safe Haskell | Safe-Inferred |
---|
Defines the Accept
type class, designed to unify types on the matching
functions in the Media module.
- class Show a => Accept a where
- parseAccept :: ByteString -> Maybe a
- showAccept :: a -> String
- matches :: a -> a -> Bool
- moreSpecificThan :: a -> a -> Bool
- mostSpecific :: Accept a => a -> a -> a
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.
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 ByteString
s
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.