Use TupleSections, not list comprehensions
This commit is contained in:
parent
1abf84feca
commit
3fec1a086a
1 changed files with 5 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE PolyKinds #-}
|
{-# LANGUAGE PolyKinds #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
{-# LANGUAGE TupleSections #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
{-# LANGUAGE UndecidableInstances #-}
|
{-# LANGUAGE UndecidableInstances #-}
|
||||||
|
@ -243,7 +244,7 @@ class (AllMime list) => AllMimeRender (list :: [*]) a where
|
||||||
-> [(M.MediaType, ByteString)] -- content-types/response pairs
|
-> [(M.MediaType, ByteString)] -- content-types/response pairs
|
||||||
|
|
||||||
instance OVERLAPPABLE_ ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
|
instance OVERLAPPABLE_ ( MimeRender ctyp a ) => AllMimeRender '[ctyp] a where
|
||||||
allMimeRender _ a = [ (ct, bs) | ct <- NE.toList $ contentTypes pctyp ]
|
allMimeRender _ a = map (, bs) $ NE.toList $ contentTypes pctyp
|
||||||
where
|
where
|
||||||
bs = mimeRender pctyp a
|
bs = mimeRender pctyp a
|
||||||
pctyp = Proxy :: Proxy ctyp
|
pctyp = Proxy :: Proxy ctyp
|
||||||
|
@ -253,7 +254,7 @@ instance OVERLAPPABLE_
|
||||||
, AllMimeRender (ctyp' ': ctyps) a
|
, AllMimeRender (ctyp' ': ctyps) a
|
||||||
) => AllMimeRender (ctyp ': ctyp' ': ctyps) a where
|
) => AllMimeRender (ctyp ': ctyp' ': ctyps) a where
|
||||||
allMimeRender _ a =
|
allMimeRender _ a =
|
||||||
[ (ct, bs) | ct <- NE.toList $ contentTypes pctyp ]
|
(map (, bs) $ NE.toList $ contentTypes pctyp)
|
||||||
++ allMimeRender pctyps a
|
++ allMimeRender pctyps a
|
||||||
where
|
where
|
||||||
bs = mimeRender pctyp a
|
bs = mimeRender pctyp a
|
||||||
|
@ -265,7 +266,7 @@ instance OVERLAPPABLE_
|
||||||
-- then this would be taken care of. However there is no more specific instance
|
-- then this would be taken care of. However there is no more specific instance
|
||||||
-- between that and 'MimeRender JSON a', so we do this instead
|
-- between that and 'MimeRender JSON a', so we do this instead
|
||||||
instance OVERLAPPING_ ( Accept ctyp ) => AllMimeRender '[ctyp] NoContent where
|
instance OVERLAPPING_ ( Accept ctyp ) => AllMimeRender '[ctyp] NoContent where
|
||||||
allMimeRender _ _ = [ (ct, "") | ct <- NE.toList $ contentTypes pctyp ]
|
allMimeRender _ _ = map (, "") $ NE.toList $ contentTypes pctyp
|
||||||
where
|
where
|
||||||
pctyp = Proxy :: Proxy ctyp
|
pctyp = Proxy :: Proxy ctyp
|
||||||
|
|
||||||
|
@ -289,7 +290,7 @@ instance ( MimeUnrender ctyp a
|
||||||
, AllMimeUnrender ctyps a
|
, AllMimeUnrender ctyps a
|
||||||
) => AllMimeUnrender (ctyp ': ctyps) a where
|
) => AllMimeUnrender (ctyp ': ctyps) a where
|
||||||
allMimeUnrender _ bs =
|
allMimeUnrender _ bs =
|
||||||
[ (ct, x) | ct <- NE.toList $ contentTypes pctyp ]
|
(map (, x) $ NE.toList $ contentTypes pctyp)
|
||||||
++ allMimeUnrender pctyps bs
|
++ allMimeUnrender pctyps bs
|
||||||
where
|
where
|
||||||
x = mimeUnrender pctyp bs
|
x = mimeUnrender pctyp bs
|
||||||
|
|
Loading…
Add table
Reference in a new issue