[Haskell-cafe] Re: howto tuple fold to do n-ary cross product?

Luke Palmer lrpalmer at gmail.com
Sun Nov 30 13:27:40 EST 2008


On Sun, Nov 30, 2008 at 11:04 AM, Larry Evans <cppljevans at suddenlink.net> wrote:
> The following post:
>
>  http://thread.gmane.org/gmane.comp.lib.boost.devel/182797
>
> shows at least one person that would find it useful, at least in
> c++.  Of course maybe it would be less useful in haskell.

The line:

  typedef boost::mpl::vector <T1Variants, T2Variants, T3Variants> TT;

Has the number of lists hard-coded as 3, and does not abstract over
it.  This corresponds to the "3" in "liftA3", or the number of <*>s in
the expression.

Abstracting over the number and types of arguments is something
neither C++ nor Haskell is very good at.  But in order to be able to
do any abstraction using such a variable-argument function, the type
systems of these languages would have to increase in complexity by
quite a lot.

Luke


More information about the Haskell-Cafe mailing list