[Haskell-cafe] Polymorphic function over pairs of maybes.
Max Rabkin
max.rabkin at gmail.com
Tue Dec 28 22:33:33 CET 2010
On Tue, Dec 28, 2010 at 21:23, Edward Amsden <eca7215 at cs.rit.edu> wrote:
> (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)))
This example demonstrates exactly why you might want to avoid doing
this... if you apply Maybe as deeply inside type constructors as
possible, you actually get
(Maybe Int, ([Maybe Char], (Maybe Int, Maybe Int)))
and in general you may not know or care whether a type is "atomic" or not.
There may be a way which works if you specify the target type as well.
More information about the Haskell-Cafe
mailing list