jspahrsummers/RxHaskell — pull request #3 by jspahrsummers (2013-04-07 03:58:20+00:00)
Title: Parameterize signals by the scheduler type they run on

There are two types of `Scheduler` in RxHaskell: `MainScheduler`s and `BackgroundScheduler`s. This parameterizes `Signal`s by scheduler type to prevent simple threading errors like this:

```hs
-- Subscribes to a signal that sends values in the background.
backgroundSignal >>: do
-- OOPS: subscribes to a cold signal that expects to run side
-- effects on the main thread!
--
-- This subscription would actually occur in the background.
coldMainThreadSignal >>: coolMainThreadEffects
```

Includes the following other changes:

* Adds a `SchedulerIO` type, which represents an IO action that should be run on a certain type of scheduler.
* Removes the `ImmediateScheduler`. Haven't found it useful in RxHaskell so far, and it complicates `SchedulerIO`.
* Signals no longer allow any `MonadIO` action, mostly just because it was getting too complicated to maintain. Only `SchedulerIO` actions are allowed for now, though it should be possible to generalize the underlying type of `SchedulerIO` to any `MonadIO` in the future.
* Likewise, disposables only allow `IO` actions now.
* Removed the `IO` and `Signal.Circuit` modules for now, since they were just proofs-of-concept and ended up falling behind.

Got a lot of help from @mchakravarty on this. All the :zap:s go to him!

@joshaber @xpaulbettsx This might interest you guys.