[reactive] More recursive fun

Creighton Hogg wchogg at gmail.com
Mon Nov 17 18:23:47 EST 2008

So in the interest of simplifying the recursive integral problem as much as
possible, to make it a bit more tractable, I've come up with another
recursive Behavior definition that I think should work if the current
implementation of integral is expected to work.  I'd just like to get an
opinion on that to see if it's a test case I should try digging harder
into.  As I said, I _think_ that this should work iff the current definition
of integral should work but if that's not true, please let me know.  My
reasoning is that this should be the equivalent of using integral with an
event stream that has a constant difference of 1.


myIntegral :: Event a -> Behavior Double -> Behavior Double
myIntegral e b = let e' = snapshot_ e b in sumB e'

x :: Event () -> Behavior Double
x e = let b =myIntegral' e b in b

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

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/20081117/f91b6f1c/attachment.htm

More information about the Reactive mailing list