cobbpg/elerea — pull request #8 by maoe (2014-11-20 06:31:53+00:00)
Title: Add MonadBase instance for SignalGen

If you put `SignalGen` at the bottom of monad transformer stacks, you'd find convenient if there were something like `liftSGen :: MonadSignalGen m => SignalGen a -> m a`. With this patch, we can use `liftBase` for this purpose. Here is a small example:

```haskell
import Control.Applicative
import Control.Monad.Base
import Control.Monad.Reader
import FRP.Elerea.Simple

newtype MyGenT m a = MyGenT { runMyGenT :: ReaderT Int m a }
deriving (Functor, Applicative, Monad, MonadTrans, MonadBase b, MonadReader Int)

type MyGen = MyGenT SignalGen

foo :: MyGen (Signal Int)
foo = do
n <- ask
liftBase $ stateful n (+1)
```