[Haskell-cafe] How to implement a digital filter, using Arrows?

Captain Freako capn.freako at gmail.com
Wed Oct 19 20:41:50 CEST 2011


John Lask wrote:

>This is literate code. It expounds on your initial question and provides
>two solutions based either on the StateArrow or Automaton....
>(Remainder omitted.)

John,

Thanks so much for your help!
I'm going to study your example code and try to understand how the
Automaton implicit plumbing is being used.
(I'm determined to get my head around this arrow concept, damn it! ;-) )

I wonder if I might pester you for the final piece of the puzzle here:
When the processing of the input stream through the filter is
complete, I need to pass the final filter state, along with the output
stream, back to the calling program.
(This is because the calling program is going to split the input
signal into conveniently sized chunks, calling my filter routine
several times, in order to process the entire input stream. It expects
to be able to pass an initial filter state into my routine, which is
just the final state of the filter that I passed back to it after the
previous call. In this way, we avoid inserting any edge artifacts at
the input stream segmentation boundaries.)

So, is it possible to `fetch' the final state out of that Automaton,
when it's finished processing the input list?

Thanks!
-db



More information about the Haskell-Cafe mailing list