
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.
Paul C wrote:
Converting it to use Reactive instead of Deus (below), it seems to work. ---- [ Paul Provides Mods to Convert to Conal Style Reactive ] ----
Paul, Thanks very much ! It works great ! This really helps get us over our learning hurdle(s). Now it's on to the Robot Wall Follower :-) Tom P.S. I had a small problem installing reactive 0.11 on ghc 6.10.3. 'checkers-0.2' complained about a multiple instance of Applicative Gen (also defined in QuickCheck) so I just commented out the instance line in checkers-0.2/src/Test/QuickCheck/Applicative.hs On Sunday 20 September 2009 03:36, you wrote:
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)