相当于 Haskell 的 WSGI/Rack 的标准 Web 服务器接口
编程语言有(事实上的)标准 Web 服务器接口,例如 Python 的 WSGI、Ruby 的 Rack。 Haskell 有类似的东西吗?我发现了两个试验,Hack 和 HSGI,但我不确定其中哪一个(或另一个)在 Haskell 土地上更受欢迎。
等待Haskell大师的建议!
There are (de facto) standard web server interfaces for programming languages e.g. WSGI for Python, Rack for Ruby. Is there the equivalent thing for Haskell? I found two trials, Hack and HSGI, but am not sure which of these (or another one) is more popular in Haskell land.
Waiting for Haskell gurus’ advices!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Haskell 的事实上的标准是 WAI (Web应用程序接口)。它受到流行的 Haskell Web 框架 Yesod 的支持,并且 Hackage 上有几个围绕该接口构建的包。
The de facto standard for Haskell is the WAI (Web Application Interface). It is supported by the popular Haskell web framework Yesod, and there are several packages built around this interface available on Hackage.
人们普遍认为,目前有三个主要的 Haskell Web 框架:Happstack、Yesod 和 Snap(按时间顺序排列)。每个框架都有自己的 Web 服务器。人们也曾尝试过其他网络服务器,但似乎都没有成功。 Happstack 计划很快更换 Web 服务器(可能更换为 Yesod 使用的 Warp)。因此,这给我们留下了 Haskell 中的两个现代主流 Web 服务器:Snap 和 Warp(也是按时间顺序排列)。
Warp 符合 wai 包中定义的接口,这似乎是定义标准 Web 服务器接口的尝试。然而,WAI 仅被当前主流 Haskell Web 服务器之一使用,因此我根本不知道如何提出令人信服的论据来证明它是一个真正的标准。只有当标准化的播放器实际上具有差异化时,你从成为标准中获得的边际收益才有用,而就 Snap 和 Warp 而言,我不相信它们确实如此。我能想到的唯一区别 Warp 和 Snap 的地方是,在简单的 pong 基准测试中,Warp 的性能比 Snap 更好。但我从未听到有人抱怨 Snap 太慢,所以 Warp 的速度似乎并没有真正区分它。
此外,WAI 在 Snap 或 Warp 出现之前就已经出现了。当 Snap 推出时,我们对界面的外观有不同的看法,这使得 WAI 不适合我们。从那时起,WAI 也不断发展,这进一步支持了它为时过早的论点。毕竟,如果标准不断变化,它有什么用呢?
如果具有各种不同功能和创新的新 Haskell Web 服务器出现爆炸式增长,那么我确信将会出现共性,从而可以开发出真正的标准。但在那之前,我认为 Web 服务器的选择相当无关紧要。 Warp 和 Snap 都是很好的 Web 服务器,不应该在您使用哪个框架的更大选择中发挥重要作用。
It is widely agreed that there are currently three major Haskell web frameworks: Happstack, Yesod, and Snap (in chronological order). Each framework has its own web server. There have been attempts at other web servers, but none of them seem to have gotten off the ground. Happstack is planning to change web servers sometime soon (probably to Warp, which Yesod uses). So this leaves us with two modern mainstream web servers in Haskell: Snap and Warp (also chronological order).
Warp conforms to the interface defined in the wai package, which seems to be an attempt at defining a standard web server interface. However, WAI is used by only one of the current mainstream Haskell web servers, so I simply don't see how one can make a compelling argument that it is a genuine standard. The marginal benefit you get from being a standard is only useful when the standardized players are actually differentiated, and in the case of Snap and Warp, I'm not convinced that they are. The only thing I can think of that differentiates Warp and Snap is that Warp has posted better performance than Snap for a simple pong benchmark. But I've never heard anyone complain that Snap is too slow, so Warp's speed doesn't seem to really differentiate it.
Furthermore, WAI came out before either Snap or Warp existed. When Snap came out, we had different opinions about how the interface should look which made WAI inappropriate for us. WAI has also evolved since then, which further supports the argument that it was premature. After all, what good is a standard if it keeps changing?
If there is an explosion of new Haskell web servers with all kinds of different features and innovations, then I'm sure commonalities would emerge from which a genuine standard could be developed. But until then, I think the choice of web server is fairly insignificant. Both Warp and Snap are good web servers and shouldn't play a significant role in the much bigger choice of which framework you use.