-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ByteString.Char8 encoder #74
Comments
I'm not sure that's really "issue" worthy, but I would happily accept a PR for such a thing. 👍 import qualified Data.ByteString.Char8 as B8
encodeByteStringChar8 :: Applicative f => Encoder f B8.ByteString
encodeByteStringChar8 = B8.unpack >$< string :) |
Well, this converts to string. I was wondering if there could be a more efficient low-level encoder. |
Quite possible, as Have you encountered any efficiency issues with Waargonaut? |
Not really, it's my first time trying to use it.
Yeah, but the internal API is a bit complicated ;) |
Phew and yay!
Yeah... it is a bit.. ahem :< Part of this is due to a slightly crazy adherence to the RFC for JSON. Hence the wacky level of detail in the string types etc. As well as being able to support round trip parsing & printing, which meant trying to find a way to remember where all the whitespace is, and what type of whitespace it is. |
One option could be to change the type alias here https://github.com/qfpl/waargonaut/blob/master/src/Waargonaut/Types/JString.hs#L78 to be a sum type that is either the internal data JString
= JString' HeXDigit
| NonUnicode Char8.ByteString |
I'm surprised there exists no encoder for that: https://hackage.haskell.org/package/waargonaut-0.8.0.1/docs/Waargonaut-Encode.html#g:4
The text was updated successfully, but these errors were encountered: