diff --git a/reactive-banana/CHANGELOG.md b/reactive-banana/CHANGELOG.md index edb42a30..ded03de2 100644 --- a/reactive-banana/CHANGELOG.md +++ b/reactive-banana/CHANGELOG.md @@ -5,10 +5,12 @@ Changelog for the `reactive-banana** package * Add `merge` and `mergeWith` combinators. [#163][], [#220][] * Make internal SCC pragmas compatible with the GHC 9.0 parser. [#208][] +* Generalise `compile`, `actuate` and `pause` to `MonadIO`. [#226][] [#163]: https://github.com/HeinrichApfelmus/reactive-banana/pull/163 [#208]: https://github.com/HeinrichApfelmus/reactive-banana/pull/208 [#220]: https://github.com/HeinrichApfelmus/reactive-banana/pull/219 + [#226]: https://github.com/HeinrichApfelmus/reactive-banana/pull/226 **version 1.2.1.0** diff --git a/reactive-banana/src/Reactive/Banana/Frameworks.hs b/reactive-banana/src/Reactive/Banana/Frameworks.hs index e42e1bc8..002664a5 100644 --- a/reactive-banana/src/Reactive/Banana/Frameworks.hs +++ b/reactive-banana/src/Reactive/Banana/Frameworks.hs @@ -301,8 +301,8 @@ liftIOLater = MIO . Prim.liftIOLater -- | Compile the description of an event network -- into an 'EventNetwork' -- that you can 'actuate', 'pause' and so on. -compile :: MomentIO () -> IO EventNetwork -compile = fmap EN . Prim.compile . unMIO +compile :: MonadIO m => MomentIO () -> m EventNetwork +compile = liftIO . fmap EN . Prim.compile . unMIO {----------------------------------------------------------------------------- Running event networks @@ -314,8 +314,8 @@ newtype EventNetwork = EN { unEN :: Prim.EventNetwork } -- | Actuate an event network. -- The inputs will register their event handlers, so that -- the networks starts to produce outputs in response to input events. -actuate :: EventNetwork -> IO () -actuate = Prim.actuate . unEN +actuate :: MonadIO m => EventNetwork -> m () +actuate = liftIO . Prim.actuate . unEN -- | Pause an event network. -- Immediately stop producing output. @@ -329,8 +329,8 @@ actuate = Prim.actuate . unEN -- i.e. you can use 'pause' as an argument to 'reactimate'. -- The network will /not/ stop immediately though, only after -- the current event has been processed completely. -pause :: EventNetwork -> IO () -pause = Prim.pause . unEN +pause :: MonadIO m => EventNetwork -> m () +pause = liftIO . Prim.pause . unEN {----------------------------------------------------------------------------- Utilities