{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-orphans #-} import Data.Aeson import Data.Aeson.Encode.Pretty (encodePretty) import Data.Proxy import Data.Text (Text) import qualified Data.Text.Lazy as T import qualified Data.Text.Lazy.Encoding as T import GHC.Generics import Servant.API import Servant.API.ContentTypes import Servant.Docs -- * Example -- | A greet message data type newtype Greet = Greet Text deriving (Generic, Show) instance FromJSON Greet instance ToJSON Greet instance MimeRender JSON Greet where toByteString Proxy v = encodePretty v instance MimeRender HTML Greet where toByteString Proxy (Greet s) = "