Tuple-like constructors

John Meacham john at repetae.net
Mon Feb 6 19:49:48 EST 2006

A much bigger problem is that treating n-tuples as nested 2-tuples
doesn't actually let you treat them generically, which was the point of
the proposed transformation.

imagine you want to replace all the values in an n-tuple with zero, what
type would it have?

zero_out :: (Int,?) -> (Int,?)
there is nothing you can put there which will let zero_out work on
arbitrarily deep tuples, its recursive call will always need to be
called on something of the appropriate type which means the nesting
depth needs to be specified in the type signature.

You can do something with classes, but then you might as well just use
the class for general n-tuples.


John Meacham - ⑆repetae.net⑆john⑈

More information about the Haskell-prime mailing list