Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalise compile, actuate and pause to MonadIO #226

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions reactive-banana/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
12 changes: 6 additions & 6 deletions reactive-banana/src/Reactive/Banana/Frameworks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down