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

Edward Amsden eca7215 at cs.rit.edu
Tue Dec 28 20:23:19 CET 2010

Hello all:

I'd like to right a function that could take a structure with type
(random example):

(Int, (String, (Int, Int)))

and another where each individual value is a Maybe of the
corresponding type, for example:
(Maybe Int, (Maybe String, (Maybe Int, Maybe Int)))

and perform a fromMaybe using the values to produce a new value with
the original types. The catch is, I'd like to be able to do that for
an n-deep structure with any type, without having to write a separate
function for them. I'm not even sure that this is possible, but
perhaps someone could explain how it is or isn't?

Edward Amsden
Computer Science
Rochester Institute of Technology

More information about the Haskell-Cafe mailing list