Is there a standard function, or family of functions, for sequencing tuples of applicatives, as a generalization of sequenceA? Like the following, except for all reasonable tuple lengths:
sequence3TupleA :: Applicative f => (f a1, f a2, f a3) -> f (a1, a2, a3)
I believe this should be possible to implement (it is for the applicatives I'm working with anyway).
I found SequenceT from Data.Tuple.Sequence, but it appears to require a monad and also it doesn't seem to actually contain the sequence function (I am probably misreading the documentation somehow).
The
SequenceTtypeclass and its methodsequenceTfrom thetuplepackage does indeed do what you're looking for. Unfortunately, this package seems to have been abandoned since 2014, before theApplicativetypeclass was introduced, so only works withMonadinstances. An issue to sort this has been open since 2017, and an associated pull request was closed by the contributor.As @lsmor mentions in a comment, this function is not difficult, its definition is: