Skip to content
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

aeson-0.11 - toEncoding #1240

Closed
lippling opened this issue Jun 16, 2016 · 3 comments
Closed

aeson-0.11 - toEncoding #1240

lippling opened this issue Jun 16, 2016 · 3 comments

Comments

@lippling
Copy link

I'm using yesod-core-1.4.20.2 and also aeson 0.11. I migrated my code to aeson's new ToJSON.toEncoding() function and realized that Yesod.Core.Json.provideJson() uses toJSON() directly.

getChangesR :: Handler TypedContent
getChangesR = do
    changes <- .....
    selectRep . provideJson $ changes

I "unlocked" the speed-up by calling encode (which uses toEncoding) directly.

getChangesR :: Handler TypedContent
getChangesR = do
    changes <- .....
    respondSource typeJson $ sendChunkLBS $ encode changes

Is there a better way to do that?
Do you plan to support toEncoding in the future (I can imagine that there are other places as well)?

@snoyberg
Copy link
Member

Sounds like a good change, I hadn't heard of this new API yet. Want to send a PR to add support fro this?

@lippling
Copy link
Author

I added pull request #1241.

@snoyberg
Copy link
Member

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants