Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuple - Apply value to tuple of functions #304

Open
gregberns opened this issue Jul 29, 2021 · 1 comment
Open

Tuple - Apply value to tuple of functions #304

gregberns opened this issue Jul 29, 2021 · 1 comment

Comments

@gregberns
Copy link

gregberns commented Jul 29, 2021

Had a problem where I had a tuple of functions (a->b, a->c), so needed to apply a to both functions and return (b,c).

Signature: (a -> b, a -> c) -> a -> (b, c)

Example: (id, increment) -> 1 -> (1,2)

Looked very general, and wonderful Haskell friends agreed:

uncurry (&&&), with a ~ (->)
bisequence, with t ~ (,) and `f ~ ((->) r)

At minimum, something similar could be added to Tuple. Bifunctor is also quite helpful (tuples, results/either, etc). And Bitraversable is new to me, but has some interesting applications.

@maxkorp
Copy link
Contributor

maxkorp commented Aug 3, 2021

Only Tuple5.apply for whatever reason is still inside the individual arity files, but Tuple.apply2...Tuple.apply5 already exist in Tuple.re, as aliases to Function.uncurry2...Function.uncurry5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants