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.

2 Answers
2

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.

This misses the point of WSGI/Rack/WAI. 1) Just because a server is popular today does not mean it will be tomorrow. 2) there are other types of backends, including cgi and desktop webkit.WAI is also a source of code reuse between frameworks - middleware/applications can easily be shared.
–
Greg WeberOct 20 '11 at 14:25

2

I'm not arguing that WAI isn't a useful piece of code. I'm answering the original question about a "(de facto) standard web server interface" for Haskell. If that's not the point, then maybe their names are misleading.
–
mightybyteOct 20 '11 at 16:43

@GregWeber I get your second point (although the code-reuse comes at the cost of restricting yourself to the common denominator the WAI API exposes), but I don't understand what the first point is referring to. Are You saying that Warp might become less popular at some time in the future, and then web-apps based on WAI might live on with the then-popular servers which provide a WAI compatibility layer (with maybe some penalty due to potential WAI impedance adaptation)?
–
hvrOct 21 '11 at 16:32

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.