@@ -238,11 +238,12 @@ class (AllMime list) => AllMimeRender (list :: [*]) a where
238238 -> a -- value to serialize
239239 -> [(M.MediaType, ByteString)] -- content-types/response pairs
240240
241−instance ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
241+instance OVERLAPPABLE_ ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
242242 allMimeRender _ a = [(contentType pctyp, mimeRender pctyp a)]
243243 where pctyp = Proxy :: Proxy ctyp
244244
245−instance ( MimeRender ctyp a
245+instance OVERLAPPABLE_
246+ ( MimeRender ctyp a
246247 , AllMimeRender (ctyp' ': ctyps) a
247248 ) => AllMimeRender (ctyp ': ctyp' ': ctyps) a where
248249 allMimeRender _ a = (contentType pctyp, mimeRender pctyp a)
@@ -250,6 +251,19 @@ instance ( MimeRender ctyp a
250251 where pctyp = Proxy :: Proxy ctyp
251252 pctyps = Proxy :: Proxy (ctyp' ': ctyps)
252253
254+
255+-- Ideally we would like to declare a 'MimeRender a NoContent' instance, and
256+-- then this would be taken care of. However there is no more specific instance
257+-- between that and 'MimeRender JSON a', so we do this instead
258+instance OVERLAPPING_ ( Accept ctyp ) => AllMimeRender '[ctyp] NoContent where
259+ allMimeRender _ _ = [(contentType pctyp, "")]
260+ where pctyp = Proxy :: Proxy ctyp
261+
262+instance OVERLAPPING_
263+ ( AllMime (ctyp ': ctyp' ': ctyps)
264+ ) => AllMimeRender (ctyp ': ctyp' ': ctyps) NoContent where
265+ allMimeRender p _ = zip (allMime p) (repeat "")
266+
253267--------------------------------------------------------------------------
254268-- Check that all elements of list are instances of MimeUnrender
255269--------------------------------------------------------------------------
@@ -308,24 +322,6 @@ instance MimeRender OctetStream BS.ByteString where
308322data NoContent = NoContent
309323 deriving (Show, Eq, Read)
310324
311−instance FromJSON NoContent where
312− parseJSON _ = return NoContent
313−
314−instance ToJSON NoContent where
315− toJSON _ = ""
316−
317−
318−instance OVERLAPPING_
319− MimeRender JSON NoContent where
320− mimeRender _ _ = ""
321−
322−instance OVERLAPPING_
323− MimeRender PlainText NoContent where
324− mimeRender _ _ = ""
325−
326−instance OVERLAPPING_
327− MimeRender OctetStream NoContent where
328− mimeRender _ _ = ""
329325
330326--------------------------------------------------------------------------
331327-- * MimeUnrender Instances