on master help sign in
Make MINIMAL contentType | contentTypes
148bb15Oleg Grenrus
servant/src/Servant/API/ContentTypes.hs+3
@@ -120,10 +120,13 @@ data OctetStream deriving Typeable
120--
120--
121class Accept ctype where
121class Accept ctype where
122 contentType :: Proxy ctype -> M.MediaType
122 contentType :: Proxy ctype -> M.MediaType
123+ contentType = NE.head . contentTypes
123
124
124 contentTypes :: Proxy ctype -> NE.NonEmpty M.MediaType
125 contentTypes :: Proxy ctype -> NE.NonEmpty M.MediaType
125 contentTypes = (NE.:| []) . contentType
126 contentTypes = (NE.:| []) . contentType
126
127
128+ {-# MINIMAL contentType | contentTypes #-}
129+
127-- | @application/json@
130-- | @application/json@
128instance Accept JSON where
131instance Accept JSON where
129 contentType _ = "application" M.// "json"
132 contentType _ = "application" M.// "json"