Skip to content

Commit

Permalink
Add derived Ord instances for all types
Browse files Browse the repository at this point in the history
Allows for the MediaType, Language, and Quality types to be ordered for
standard use in storage or lookup. Bumps version number to 0.6.
  • Loading branch information
fisx authored and zmthy committed Feb 24, 2015
1 parent f59ea2a commit 0fb5642
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion http-media.cabal
@@ -1,5 +1,5 @@
name: http-media
version: 0.5.1
version: 0.6.0
license: MIT
license-file: LICENSE
author: Timothy Jones
Expand Down
2 changes: 1 addition & 1 deletion src/Network/HTTP/Media/Language/Internal.hs
Expand Up @@ -32,7 +32,7 @@ import Network.HTTP.Media.RenderHeader (RenderHeader (..))
--
-- > language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
newtype Language = Language [CI ByteString]
deriving (Eq)
deriving (Eq, Ord)

-- Note that internally, Language [] equates to *.

Expand Down
2 changes: 1 addition & 1 deletion src/Network/HTTP/Media/MediaType/Internal.hs
Expand Up @@ -31,7 +31,7 @@ data MediaType = MediaType
{ mainType :: CI ByteString -- ^ The main type of the MediaType
, subType :: CI ByteString -- ^ The sub type of the MediaType
, parameters :: Parameters -- ^ The parameters of the MediaType
} deriving (Eq)
} deriving (Eq, Ord)

instance Show MediaType where
show = BS.unpack . renderHeader
Expand Down
2 changes: 1 addition & 1 deletion src/Network/HTTP/Media/Quality.hs
Expand Up @@ -26,7 +26,7 @@ import Network.HTTP.Media.RenderHeader (RenderHeader (..))
data Quality a = Quality
{ qualityData :: a
, qualityValue :: Word16
} deriving (Eq)
} deriving (Eq, Ord)

instance RenderHeader a => Show (Quality a) where
show = BS.unpack . renderHeader
Expand Down

0 comments on commit 0fb5642

Please sign in to comment.