[reactive] Newbie Difficulty ..
Paul C
paulq2o0 at yahoo.co.uk
Sun Sep 20 06:36:46 EDT 2009
On Thu, Sep 17, 2009 at 05:07:25PM -0700, Tom Poliquin wrote:
> . . . .
> This exhibits the same untoward hanging behavior
> on a blocking read inside 'runReactor'.
> . . .
> If it would be more appropriate we can try to convert
> it to Colins' style.
In case it helps....
Converting it to use Reactive instead of Deus (below), it seems to work.
The main change is to use atTimes to generate 'ticker', and to
redefine constB. (The other changes just swap some arguments in the
function passed to snapshotWith, which seems to be defined slightly
differently in Deus). It produces output (increasing temperatures)
anyway.
Regards
Paul
5c5
< -- Jules Reactive
---
> -- FRP.Reactive
7c7,8
< import Deus.Reactive
---
> import FRP.Reactive --was: import Deus.Reactive
> import FRP.Reactive.LegacyAdapters
19c19
< constB value = timeFunction (constFun value)
---
> constB value = fmap (const value) time --was: constB value = timeFunction (constFun value)
27c27
< (\watts ticker -> (\temp -> temp+(watts/100.0)))
---
> (\ticker watts -> (\temp -> temp+(watts/100.0))) --swapped args to Lambda Expr.
36c36
< (\temp tick -> (600.0 - temp) / 1000.0)
---
> (\tick temp -> (600.0 - temp) / 1000.0) --swapped args to Lambda Expr.
46c46
< (snapshotWith (\t tick -> "\n" ++ show t)
---
> (snapshotWith (\tick t -> "\n" ++ show t) --swapped args to Lambda Expr.
63c63
< ticker <- timewiseIterate 10000 (+1) 0
---
> let ticker = fmap (const 1) (atTimes [0,0.01..] ) --was: ticker <- timewiseIterate 10000 (+1) 0
65c65
< runReactor (furnaceMain ticker)
---
> adaptE (furnaceMain ticker)
More information about the Reactive
mailing list