servant icon indicating copy to clipboard operation
servant copied to clipboard

servant-server has a transitive dependency on blaze-html

Open duijf opened this issue 5 years ago • 3 comments

The servant-server package has a dependency on wai-app-static, which has a dependency on blaze-html. I noticed this because blaze-html sometimes causes builds to fail on our CI due to timeouts/long compile times. (Caching helps until we need to rebuild the cache).

As far as I can tell, this dependency is included because of the Servant.Server.StaticFiles module.

Our usecase for servant-server does not include the StaticFiles module, and increasing closure size/compilation times feels like it might not be warranted.

Would the Servant maintainers be open for one of the following:

  • Shipping the StaticFiles module in another package (e.g. servant-static or whatever naming is preferred). This is a backwards incompatible change albeit with a single line (?) fix for most users.
  • Doing something with Cabal flags so wai-app-static becomes an optional dependency of the servant-server package. No concrete proposal, I just have a vague idea it might be possible
  • Something else entirely that removes this transitive dependency from the servant-server package

Opening this ticket to discuss options. I am willing to create a PR; just wanted to gauge interest before sending one.

Thoughts?

duijf avatar Jun 12 '19 18:06 duijf

I'm (personally) certainly open to discussing this possibility, even though I must say that it's certainly nicer to ship those functions in servant-server, without having to bring in an extra-package or pass a special flag (even though we could make the flag True by default, to make the wai-app-static dependency opt-out -- I'm however personally not a huge fan of flag-dependent dependencies).

However, wai-app-static apparently only depends on blaze-html for defaultListing. Perhaps a less "convoluted" solution to your problem would be to offer a PR to wai-app-static that offers an implementation of defaultListing that doesn't require blaze-html, since there isn't much code or complexity involved in its definition?

alpmestan avatar Jun 13 '19 07:06 alpmestan

I'm slightly :+1: on removing wai-app-static dependencies from servant-server. wai-app-static is quite heavy package.

phadej avatar Jul 17 '19 07:07 phadej

I'd also be keen to see the wai-app-static integration moved to a separate package. In my case, this is primarily because it uses Template Haskell, which brings it's share of issues, e.g. for cross-compilation.

For now, I'm having to point some of my projects to https://github.com/georgefst/servant/tree/no-static.

georgefst avatar Aug 17 '23 09:08 georgefst