Heinrich Apfelmus wrote:

[...]
> 
> Looks interesting. I have several questions:
> 
> 1) Is it possible to change the frequency / time intervals dynamically?

Yes.

> 2) When multiple timers are running, do you schedule the IO events or
> are they interleaved concurrently? More generally, how would I hook up
> your package into an existing or custom event loop?

They are interleaved. The library is only concerned with the thread it is 
used from. I don't know, what you want to do, so I can't really respond to 
the last question.

> 3) Any chance to drop the QT dependency, perhaps at the cost of
> accuracy? Most people probably don't need nanosecond resolution. Maybe a
> pure Haskell implementation with threads?

My first attempt was to use 'threadDelay'. I found that surprisingly 
inaccurate. Timing operations from C seem to be much better.

Then I searched for cross-platform operations to let threads wait, but that 
isn't easy for Mac OS X. So I settled for Qt.

The repo contains multiple backends. If you don't care about accuracy at 
all, you could use the 'simpleThreadDelay' backend. If you want better 
accuracy and don't care about Mac OS X, you could use the 'posix-timer' 
backend. (Although in both cases implementing the functionality yourself 
might be easier. Also look at "clock" and "posix-timer" from hackage.)

(The best thing would be to implement accurate thread waiting operations on 
Mac OS X. As I don't have a Mac I didn't do that. This should better be done 
in the 'clock' or 'posix-timer' package than in 'clocked', though.)

HTH,
Sönke

> 
> I'm asking because sooner or later, I need to incorporate similar timing
> stuff into my  reactive-banana  FRP library
> 
>    http://haskell.org/haskellwiki/Reactive-banana
> 
> 
> Best regards,
> Heinrich Apfelmus
> 
> --
> http://apfelmus.nfshost.com
> 
> _______________________________________________
> haskell-art mailing list
> haskell-art@lurk.org
> http://lists.lurk.org/mailman/listinfo/haskell-art


_______________________________________________
haskell-art mailing list
haskell-art@lurk.org
http://lists.lurk.org/mailman/listinfo/haskell-art

Reply via email to