[Haskell-beginners] Timer Events?

Edward Z. Yang ezyang at MIT.EDU
Tue Nov 30 23:15:20 CET 2010


Excerpts from matthew coolbeth's message of Tue Nov 30 16:49:52 -0500 2010:
> I'd like to write a Haskell program that executes an IO action every
> 50 milliseconds.
> It would be most helpful if someone could point me in the right direction.

Hello Matthew,

Check out forkIO and threadDelay.

http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Control-Concurrent.html

Basically, you can fork a thread and then have it do something, delay 50 ms,
and then invoke itself again.

Edward



More information about the Beginners mailing list