[Haskell-cafe] "first class" tuples?
bugfact at gmail.com
Tue Feb 17 08:42:48 EST 2009
Tuples in Haskell always have annoyed me a bit since each tuple of different
dimension is hardcoded (I guess compilers enforce a maximum dimension on
Since a tuple represents a fixed size data structure with different types at
each coordinate, it feels as it should be possible to have a couple of type
and data constructors to build a tuple, and to use recursion at the type
level to have functions operate on tuples of any dimension.
E.g. one could then have a tmap function that takes a tuple of functions and
a tuple of values and applies the function at coordinate N to the value at
Is something like this possible today in Haskell, e.g. using new features
like type families, GADTs, template haskell, etc? Or do we need dependent
types for it?
In C++x0 I believe it is now possible to do so, since they even allow a
variable number of template arguments, using recursion at compile time (see
Grapefruit has something like first class records, so I guess it should be
possible (and simpler) to do this for tuples?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe