ocharles/engine.io — pull request #14 by katyo (2014-11-09 19:29:36+00:00)
Title: Parametrizing EventHandler using monad

Allows to use custom monad in `EventHandler` instead of `IO`.
Implementation utilizes `socketAppToIO` method for converting custom monad to `IO`.
```
class SocketAppToIO m m' where
socketAppToIO :: m (m' a -> IO a)

instance (Monad m) => SocketAppToIO m IO where
socketAppToIO = return id
```
As you can see, backward compatibility are also present.

So, to use Yesod Handler monad in `EventHandler` we can do it:
```
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
instance MonadIO m => SocketAppToIO (HandlerT master m) (HandlerT master IO) where
socketAppToIO = handlerToIO
```