Look at the HList stuff by Oleg and others and you'll find the kind of
tuples you suggest.

2009/2/17 Peter Verswyvelen <[email protected]>:
> 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
> tuples?)
> 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
> coordinate N.
>
> 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
> e.g. 
> http://publib.boulder.ibm.com/infocenter/comphelp/v9v111/index.jsp?topic=/com.ibm.xlcpp9.aix.doc/standlib/header_tuple.htm
>  )
> Grapefruit has something like first class records, so I guess it should be
> possible (and simpler) to do this for tuples?
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to