haskell-servant / servant

Servat is a Haskell DSL for describing, serving, querying, mocking, documenting web applications and more!
https://docs.servant.dev/
1.82k stars 412 forks source link

Upstreaming RawText from servant-http2-client #1603

Open tchoutri opened 2 years ago

tchoutri commented 2 years ago

@lucasdicioccio Would you be okay with the upstreaming of your RawText into servant? I am specifically thinking about this code:

data RawText

instance Accept RawText where
  contentType _ = "text/plain"

instance MimeRender RawText Text where
  mimeRender _ = fromStrict . Encoding.encodeUtf8

instance MimeUnrender RawText Text where
  mimeUnrender _ = pure . Encoding.decodeUtf8 . toStrict
lucasdicioccio commented 2 years ago

Yes if you can use it, definitely do that!

Servant's BSD-3 license is okay for me.

lucasdicioccio commented 2 years ago

Note that to package that in a pretty module you may want to have one module/file per "frequent combinations" of lazy/non-lazy and utf-8/latin-9 (albeit latin-9 hopefully is not really in demand/use much).