[reactive] Time leak problem with integral

Mitsutoshi Aoe maoe.maoe at gmail.com
Sat Jan 30 12:23:11 EST 2010


Hi folks,

I've got stacked now because of a time leak problem with integral. 
The following program leaks CPU-time gradually:

> import FRP.Reactive
> import FRP.Reactive.LegacyAdapters
> import Control.Applicative

> type Velocity = Double
> type Position = Double

> data Car = Car { vel :: Velocity, pos :: Position } deriving Show

> velocity :: Behavior Velocity
> velocity = 1

> position :: Behavior Position
> position = integral (atTimes [0, 0.5 ..]) velocity

> car :: Behavior Car
> car = Car <$> velocity <*> position

> main :: IO ()
> main = adaptE $ print <$> car `snapshot_` atTimes [0, 0.5..]

1) why is the leak happen?
2) how can I fix this problem?

Some more detailed informations:
* reactive 0.11.4
* GHC 6.12.1
* Gentoo Linux (2.6.32-tuxonice, x86_64)
* compiled with or without -O2 flag

Thanks,
-- 
Mitsutoshi Aoe



More information about the Reactive mailing list