yesodweb/wai — pull request #50 by maoe (2012-02-13 10:06:47+00:00)
Title: Add new APIs for EventSource

It would be convenient that `evnetSourceApp` has a non-Chan interface. If we have a channel of `Chan SomeAppSpecificEvent` or a transactional channel `TChan ServerEvent`, the current interface is not usable. Because we have to implement something like `Chan SomeAppSpecificEvent -> Chan ServerEvent` or `TChan a -> Chan a`.

We can provide non-Chan interfaces instead. I added two new interfaces:

* `eventSourceAppSource :: Source IO ServerEvent -> Application`
* `eventSourceAppIO :: IO ServerEvent -> Application`

If we have a transactional channel, we can write this:

eventSourceAppIO $ atomically $ readTChan tChan

Other changes:

* Renamed `eventSourceApp` into `eventSourceAppChan`, made `eventSourceApp` DEPRECATED.
* Added new API to the example in Main.hs.

I should I don't think these name of the API are appropreate, though.