Comments (6)
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
:)
from waargonaut.
Well, this converts to string. I was wondering if there could be a more efficient low-level encoder.
from waargonaut.
Quite possible, as ByteString.Char8
is limited to the latin1 charset which is a subset of what the JSON RFC allows. So you could see how well it goes to just drop it directly into the encoded structure.
Have you encountered any efficiency issues with Waargonaut?
from waargonaut.
Have you encountered any efficiency issues with Waargonaut?
Not really, it's my first time trying to use it.
So you could see how well it goes to just drop it directly into the encoded structure.
Yeah, but the internal API is a bit complicated ;)
from waargonaut.
Not really, it's my first time trying to use it.
Phew and yay!
Yeah, but the internal API is a bit complicated ;)
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.
from waargonaut.
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 JString'
representation or a narrower NonUnicode
type... maybe:
data JString
= JString' HeXDigit
| NonUnicode Char8.ByteString
from waargonaut.
Related Issues (20)
- Waargonaut.Decode.either's document or implementation maybe wrong HOT 1
- CommaSeparated's _Empty Prism doesn't obey Prism law
- Default / example parser? HOT 2
- Restrictive upper bounds for generics-sop-0.40.1 HOT 2
- Encoder mapLikeObj API thoughts HOT 1
- Uppercase HeXDigit's aren't interpreted correctly
- JSON unicode strings should be parsed into... well, unicode.
- Help: What is the best way to encode optional fields? HOT 5
- Help: Prettier HOT 3
- Changing compiler via nix doesn't apply overlays
- Upgrade to latest hw-json
- documentation incorrect
- _optionsFieldName is called twice when generating an encoding using Waargonaut.Generic.gEncoder HOT 1
- Fix CI for GHC 8.0.2 HOT 1
- GHC 8.10 support? HOT 2
- Nix build is stale HOT 4
- Not available in Stackage
- Conversion of Scientific to JNumber computes an incorrect exponent
- Still not available on Stackage
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from waargonaut.