on master help sign in
Use string conversions in example
commit3451dcf186a647bf05988f18d961fd11fbd608fc authorThomas Sutton <me@thomas-sutton.id.au> dateThu 19 Feb 2015, 13:03 (12 years ago) parent508b9f9
1 file changed+3−6
example/greet.hs+3−6
example/greet.hs+3−6
@@ -8,9 +8,8 @@
88import Data.Aeson
99import Data.Aeson.Encode.Pretty (encodePretty)
1010import Data.Proxy
11+import Data.String.Conversions
1112import Data.Text (Text)
12−import qualified Data.Text.Lazy as T
13−import qualified Data.Text.Lazy.Encoding as T
1413import GHC.Generics
1514import Servant.API
1615import Servant.API.ContentTypes
@@ -26,12 +25,10 @@ instance FromJSON Greet
2625instance ToJSON Greet
2726
2827instance MimeRender JSON Greet where
29− toByteString Proxy v = encodePretty v
28+ toByteString Proxy = encodePretty
3029
3130instance MimeRender HTML Greet where
32− toByteString Proxy (Greet s) = "<h1>" <> (c s) <> "</h1>"
33− where
34− c = T.encodeUtf8 . T.fromStrict
31+ toByteString Proxy (Greet s) = "<h1>" <> cs s <> "</h1>"
3532
3633-- We add some useful annotations to our captures,
3734-- query parameters and request body to make the docs