开发者

Standard web server interface equivalent to WSGI/Rack for 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 m开发者_高级运维ore popular in Haskell land.

Waiting for Haskell gurus’ advices!


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜