Control-event: Difference between revisions
(Initial project page) |
m (Repository link dead) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
The control-event package[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/control-event] | The control-event package provides the capability to schedule and cancel IO () actions for arbitrary absolute times. Source code is available from hackage[http://hackage.haskell.org/cgi-bin/hackage-scripts/package/control-event] and the repository[http://code.haskell.org/~tommd/control-event/]. | ||
A shim module that provides identical API as control-timeout (relative expiration times) is available, though it is also much less efficient then either control-timeout or control-event with absolute times. | A shim module that provides identical API as control-timeout (relative expiration times) is available, though it is also much less efficient then either control-timeout or control-event with absolute times. | ||
Line 29: | Line 29: | ||
* While no work is planned, if someone were looking for a quick project then they could move this package over to the 'time' packages and eliminate the 'old-time' dependency. | * While no work is planned, if someone were looking for a quick project then they could move this package over to the 'time' packages and eliminate the 'old-time' dependency. | ||
== | == See Also == | ||
* poorly written blog entries [http://sequence.complete.org/node/375][http://sequence.complete.org/node/376]. | |||
[[Category:Libraries]] | |||
[[Category:Packages]] | |||
[[Category:Pages with broken file links]] |
Latest revision as of 10:06, 20 April 2021
Introduction
The control-event package provides the capability to schedule and cancel IO () actions for arbitrary absolute times. Source code is available from hackage[1] and the repository[2].
A shim module that provides identical API as control-timeout (relative expiration times) is available, though it is also much less efficient then either control-timeout or control-event with absolute times.
Example Code
Code generally looks like this:
import Control.Monad
import Control.Event
main = do
evtSys <- initEventSystem
...
doStuff action delay race evtSys
doStuff action delay race eS =
(TOD sec ps) <- getClockTime
eid <- addEvent eS (TOD (sec + delay) ps) action
res <- race
when res (cancelEvent eS eid)
runUserOperation a
The test code can serve as a decent example as well.
Potential Future Changes
- While no work is planned, if someone were looking for a quick project then they could move this package over to the 'time' packages and eliminate the 'old-time' dependency.