Is there a library that has n-ary versions of tuple functions like first
, ***
, etc, through Template Haskell (or using some other method).
Ideally I would like to able to say
$(select 3 [0, 1])
which we make the lambda
\(x, y, z) -> (x, y)
and for a generic ***
for functions
$(tapply 3 [(0, "f"), (1, "g"), (2, "h")])
which would make the lambda
\f g h (x, y, z) -> (f x, g y, h z)
Other n-ary functions would also be nice, but those are the two I need currently.