[Haskell-cafe] Polymorphic function over pairs of maybes.

Stephen Tetley stephen.tetley at gmail.com
Tue Dec 28 23:37:55 CET 2010


On 28 December 2010 21:44, Edward Amsden <eca7215 at cs.rit.edu> wrote:
[SNIP]

> I'm writing a very similar library to Yampa. (I would be patching
> Yampa, but the code is a mess, so I decided to try starting from
> scratch.)
> Basically, I have a signal processing loop, where values are passed
> updated with a Maybe, representing whether there is or is not a change
> to the value. I could use a single Maybe around the whole thing, but
> that would require then re-updating a potentially large structure
> entirely. I want to be able to build a combinator that can combine two
> signal-fetching actions into a larger one:
>

Hi Edward

That's a tough proposition - phrased in a different way, you want
syntax (i.e algebraic data types) with holes. Functors (List,
Data.Sequence, ...) and Bifunctors (pairs and Either, ...) have
obvious holes, and working with holey things is possible[*] but its
probably way too far out for signal processing where you have
efficiency concerns.

Is it common for Reactive libraries like Yampa to operate on a large
"World" datatype - rather than streams of signals of some atomic unit
like Double? If it were me, I'd want to answer this question first
before attempting to represent it.


[*] See Conor McBride's "Clowns and Jokers" for instance:
http://personal.cis.strath.ac.uk/~conor/Dissect.pdf



More information about the Haskell-Cafe mailing list