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

Edward Amsden eca7215 at cs.rit.edu
Tue Dec 28 22:44:06 CET 2010


Aditya: Not quite, because I'm actually looking to extract values from
a functor (Maybe) with a default.

Stephen: Thanks, I'll take a look at those. I do have a need for it.
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:

IO (Maybe a) -> IO (...) -> IO (Maybe a, (...))

and then an action that could, given the previous value:
(a, (...))

update any places in this chain of pairs where the Maybe is not Nothing.

Jake: I'd prefer to not have to define class instances for the types.
It would get tedious and awkward quickly. (See above for a description
of what I'm looking for.)

-- 
Edward Amsden
Undergraduate
Computer Science
Rochester Institute of Technology
www.edwardamsden.com



More information about the Haskell-Cafe mailing list