8000 Stop using the HTTP package. by mt-caret · Pull Request #7456 · jgm/pandoc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Stop using the HTTP package. #7456

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

Merged
merged 3 commits into from
Aug 3, 2021
Merged

Stop using the HTTP package. #7456

merged 3 commits into from
Aug 3, 2021

Conversation

mt-caret
Copy link
Contributor
@mt-caret mt-caret commented Jul 24, 2021

Given ozanmakes/markup.rocks#21 and #4535, I've recently been working on getting pandoc to build with ghcjs, which I've been able to do here: https://github.com/mt-caret/pandoc-ghcjs. Unfortunately, while the build succeeds there seems to be some problems with the JavaScript emitted so it does not work as-is (I'd love some help understanding what's wrong if anybody is interested). In the meantime, there seem to be relatively trivial changes that I can upstream to make pandoc more ghcjs-friendly.

Pandoc only depends on the urlEncode function in the package, which is also provided by http-types. The HTTP package also depends on the network package, which has difficulty building on ghcjs. I've created some benchmarks and fuzzing tests (https://github.com/mt-caret/bench-url-encode), and based on the results there unfortunately http-type's implementation seems to be 50% slower.

We only depend on the urlEncode function in the package, which is also
provided by http-types. The HTTP package also depends on the network
package, which has difficulty building on ghcjs.
@jgm
Copy link
Owner
jgm commented Jul 29, 2021

Unfortunately this is not the only transitive dependency on network in pandoc (cabal-plan will give you a nice graph).

@jgm
Copy link
Owner
jgm commented Jul 29, 2021

Even so, avoiding a dependency on HTTP seems a win.

@mt-caret
Copy link
Contributor Author
mt-caret commented Jul 31, 2021

Unfortunately this is not the only transitive dependency on network in pandoc (cabal-plan will give you a nice graph).

Yeah, I'm planning to spend more time working on removing the network dependency (or fixing it so it builds on ghcjs). Another issue is how everything depends on zlib; my guess is we need to add a bunch of functionality to https://github.com/GaloisInc/pure-zlib in order to use it as a drop-in replacement for zlib, which looks pretty painful.

Even so, avoiding a dependency on HTTP seems a win.

Sounds good! Is there anything else I should do before merging?

pandoc.cabal Outdated
@@ -599,6 +598,7 @@ library
Text.Pandoc.UTF8,
Text.Pandoc.Templates,
Text.Pandoc.XML,
Text.Pandoc.Network.HTTP,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to make this an internal (non-exported) module.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

pandoc.cabal Outdated
@@ -598,7 +598,6 @@ library
Text.Pandoc.UTF8,
Text.Pandoc.Templates,
Text.Pandoc.XML,
Text.Pandoc.Network.HTTP,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this now appear in other-modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that; fixed.

@jgm jgm merged commit 407de98 into jgm:master Aug 3, 2021
@jgm
Copy link
Owner
jgm commented Aug 3, 2021

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

Successfully merging this pull request may close these issues.

2 participants
0