[Haskell-cafe] FFI and callbacks

Gracjan Polak gracjan at acchsh.com
Mon Aug 22 08:36:12 EDT 2005

Duncan Coutts wrote:
> Most toolkits with a main loop system allow you to setup timers. In the
> Gtk2Hs bindings we can use this trick:
> -- 50ms timeout, so GHC will get a chance to scheule about 20 times a second
> -- which gives reasonable latency without the polling generating too much
> -- cpu load.
> timeoutAddFull (yield >> return True) priorityDefaultIdle 50

Just for the record, above line in wxHaskell is spelled as:

timer mainWindow [ interval := 50, on command := return () ]

By the way, thanks for this tip! This helped me to work around 
showstopper bug in my program :)


More information about the Haskell-Cafe mailing list