[Haskell-cafe] Re: Is this haskelly enough?
dm.maillists at gmail.com
Wed Jul 18 17:33:13 EDT 2007
On Wednesday 18 July 2007 21:16, Johan Tibell wrote:
> It would be nice if it was possible to capture this kind of behavior in a
> high order function just like map though. I guess the problem is that the
> function to map will take different number of arguments depending on the
> use case.
> lookAtTwo a b = ...
> lookAtThree a b c = ...
> map' :: (a -> ... -> b) -> [a] -> [b]
> The parameter take a variable number of parameters.
> Note: I don't know if there is a sensible way to write map' at all. Perhaps
> explicit recursion is better in this case.
Oleg (unsurprisingly) has some type-class hackery for polyvariadic/keyword
functions. Probably do what you need, possibly be overkill for what you
want... here it is anyway.
More information about the Haskell-Cafe