On Mon, 8 Dec 2008, John Lato wrote: > My suspicion is that signal processing should be done with a Stream > type, something like the following: > > data Stream a = Stream a | EOF | Err String > > using some sort of buffer (Arrays, StorableVector, etc.). The real > problem is that this leads to notably lower-level code than one would > like to write. I've been toying with ways around this problem > recently, but so far have nothing concrete.
You do not need to bake the (Err String) into the Stream type. You can just use (Maybe ErrorString, StorableVector.Lazy), where the ErrorString is computed only after completely evaluating StorableVector.Lazy. In case of Nothing, the stream could be computed without errors, and in case of Just e the stream is truncated for the reason of 'e'. The pair (Maybe ErrorString, a) can also be turned into a specific type and this is what I have implemented as asynchronous exceptions: http://hackage.haskell.org/packages/archive/explicit-exception/0.0.1/doc/html/Control-Monad-Exception-Asynchronous.html _______________________________________________ haskell-art mailing list haskell-art@lurk.org http://lists.lurk.org/mailman/listinfo/haskell-art