[reactive] Curious crash

Creighton Hogg wchogg at gmail.com
Wed Nov 12 15:54:09 EST 2008


So below is something I discovered that seems very strange.

If you run the following code as is, it will run & you'll get stuck in the
already documented integral loop.
If you replace the use of events in main with events', the program consumes
all available memory & locks up hard.

I know I'm horribly abusing Reactive here, but I don't see why it should
fail _so_ ungracefully.

Cheers,
Creighton

import FRP.Reactive
import FRP.Reactive.LegacyAdapters
import Control.Concurrent
import Control.Monad

x :: Event () -> Behavior Double
x e = b where b = integral e b

events :: Event ()
events = atTimes [0.1,0.2]

events' :: Event ()
events' = once events

schedule a = threadDelay 100000 >> a

main = do
 c <- makeClock
 u <- mkUpdater (cGetTime c) (fmap print $  x events)
 forever $ schedule u
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/reactive/attachments/20081112/248eacb1/attachment.htm


More information about the Reactive mailing list