[Haskell-cafe] Mission: To take args from an n-tuple ... generally

Martin Hofmann martin.hofmann at uni-bamberg.de
Thu Jan 31 10:14:39 EST 2008


> > I wondered, why not take an n-tuple of arguments s.t.
> > 
> >    multApply' :: (a1->a2->...->an->o) -> (a1,(a2,(...(an,o)...))) ->
> o
> > 
> I'm not sure what you're trying to do here. Why is there an o in the
> argument? Also, do you really mean the number of arguments expected to
> match the number of arguments given? 
> 

You are right. It should rather be

multApply' :: (a1->a2->...->an->o) -> (a1,(a2,(...(an-1,an)...))) -> o

as e.g. in:

multApply' take (2,['a','b','c']) 


> Also you might want to check out Olegon polyvariadic functions:
> http://okmij.org/ftp/Haskell/vararg-fn.lhs 

Thanks, I will have a look at this.


Martin



More information about the Haskell-Cafe mailing list