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

aditya siram aditya.siram at gmail.com
Tue Dec 28 22:22:51 CET 2010


Although I don't understand it myself Oleg's deepest functor [1] seems
to be what you're looking for.
-deech

[1] http://okmij.org/ftp/Haskell/deepest-functor.lhs

On Tue, Dec 28, 2010 at 1:23 PM, Edward Amsden <eca7215 at cs.rit.edu> wrote:
> 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
> Undergraduate
> Computer Science
> Rochester Institute of Technology
> www.edwardamsden.com
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list