[Haskell-cafe] How to implement digital filters using Arrows

Captain Freako capn.freako at gmail.com
Tue Nov 1 15:48:46 CET 2011

On Mon, Oct 31, 2011 at 3:19 PM, John Lask <jvlask at hotmail.com> wrote:
> On 1/11/2011 1:35 AM, Captain Freako wrote:
> you need to study ArrowLoop and understand that.

Thanks, John.

I'm working my way through Hughes' suggested exercise in `Programming
with Arrows', to wit:

"The reader who finds this argument difficult should work out the
sequence of approximations in the call `runSF (loop (arr swap))

I think I understand how wrapping `cs' in `stream' provides the needed
delay of evaluation, in order to avoid a self propagating `undefined'.
However, it's not clear to me exactly what finally triggers the
evaluation of c0. So, for instance, I think the `sequence of
approximations' looks like this:

1) let (bs, cs) = unzip (map swap (zip as (_:_:_:...))) in bs :
bs = [c0, (_:_:...)]
cs = [1,2,3]

At this point, `c0' is equal to 1, but what triggers the evaluation of
c0? Is it simply the binding of it to `b0'? If so, then why aren't
`c1' and `c2' also evaluated, which would yield undefined values?


More information about the Haskell-Cafe mailing list