Hi John, Thanks for all your help. I've been studying your suggested code:
> type FilterAu b c = Automaton (->) b c > liftAu :: ((x,FilterState s)->(y,FilterState s)) -> FilterState s -> FilterAu x y > liftAu f s0 = proc x -> do > rec (y,s') <- arr f -< (x,s) > s <- delay s0 -< s' > returnA -< y runAutomaton is a bit cumbersome, so define a custom run function that takes a list > runAuto a [] = [] > runAuto (Automaton f) (x:xs) = let > (y,a) = f xt > in y:runAuto a xs as well as the various instance definitions for Automaton. I think I understand how the `returnA' in the last line of your `liftAu' function is getting translated by those instance definitions into: c where c = Automaton ( arr id &&& arr (const c) ) and, furthermore, how that is passing the supplied `y' into the first element of the resulting couple. However, I don't understand how the recursively defined `c' is capturing the modified filter state and preserving it for the next call. It seems like the Automaton being referred to by `c' is a newly constructed entity, which knows nothing about the current state of the running Automaton. Any help in understanding this would be greatly appreciated. Thanks! -db _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
