[haskell-art] Haskell audio I/O packages
Henning Thielemann
lemming at henning-thielemann.de
Mon Dec 8 13:54:38 GMT 2008
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
More information about the haskell-art
mailing list