[Haskell-cafe] Thinking about an unlistN

Justin Bailey jgbailey at gmail.com
Mon Aug 11 15:06:40 EDT 2008


On Sun, Aug 10, 2008 at 11:47 AM, Michael Feathers
<mfeathers at mindspring.com> wrote:
>
> unlist3 :: (a -> a -> a -> b) -> [a] -> b
> unlist3 f (x:y:z:xs) = f x y z
>

Oleg has written about this. Be careful, its easy to overdose on:

"Functions with the variable number of (variously typed) arguments"
http://okmij.org/ftp/Haskell/types.html#polyvar-fn

>
> I was also wondering whether the function can be generalized to N or whether
> this is just one of those edges in the type system that you can't abstract
> over.

With template haskell I don't think that exists.

Justin


More information about the Haskell-Cafe mailing list