module Servant.HTML.Fiat(HTML) where
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
import qualified Data.List.NonEmpty as NE
import Data.Typeable (Typeable)
import qualified Network.HTTP.Media as M
import Servant.API (Accept (..), MimeRender (..))
data HTML deriving Typeable
instance Accept HTML where
contentTypes :: Proxy HTML -> NonEmpty MediaType
contentTypes Proxy HTML
_ =
ByteString
"text" ByteString -> ByteString -> MediaType
M.// ByteString
"html" MediaType -> (ByteString, ByteString) -> MediaType
M./: (ByteString
"charset", ByteString
"utf-8") MediaType -> [MediaType] -> NonEmpty MediaType
forall a. a -> [a] -> NonEmpty a
NE.:|
[ByteString
"text" ByteString -> ByteString -> MediaType
M.// ByteString
"html"]
instance MimeRender HTML LBS.ByteString where
mimeRender :: Proxy HTML -> ByteString -> ByteString
mimeRender Proxy HTML
_ = ByteString -> ByteString
forall a. a -> a
id
instance MimeRender HTML BS.ByteString where
mimeRender :: Proxy HTML -> ByteString -> ByteString
mimeRender Proxy HTML
_ = ByteString -> ByteString
LBS.fromStrict